When vue edits and adds a pop-up box, it already assigns a value to the form when editing, and then clicks add when the form already has a value, how to click add to return to the original state?

problem description

the environmental background of the problems and what methods you have tried

handleSubmit (name) {

            this.$refs[name].validate(valid => {
                if(valid && this.formValidate.Id == undefined || this.formValidate.Id == "") {
                    //
                    localStorage.setItem(
                        "DetailedPackage",
                        JSON.stringify(this.DetailedPackage)
                    );
                    //
                    localStorage.setItem(
                        "PricePackage",
                        JSON.stringify(this.PricePackage)
                    );
                    //data
                    Create(this.Interface, this.formValidate).then(res => {
                        console.log(res.data)
                        this.reload();
                        //Id
                        this.packageId = res.data.Data.Id
                        this.packageDetail = JSON.parse(
                            localStorage.DetailedPackage
                        );
                        console.log(this.packageDetail)
                        this.packagePrise = JSON.parse(
                            localStorage.PricePackage
                        );
                        console.log(this.packagePrise)
                        if(res.data.ErrCode === "0") {
                            AddOrUpdateCourse(this.Interface, {
                                PackageId: this.packageId,
                                CourseCollection: this.packageDetail
                            }).then(res => {
                                console.log(res.data)
                            }).catch(err => {
                                console.log(err)
                            })
                            AddOrUpdatePrice(this.Interface, {
                                PackageId: this.packageId,
                                PriceCollection: this.packagePrise
                            }).then(res => {
                                console.log(res.data)
                                this.$Message.success("");
                                this.reload();
                            }).catch(err => {
                                console.log(err)
                            })
                        }
                    }).catch(err => {
                        console.log(err)
                    })

                } else {
                    //
                    Update(this.Interface, this.formValidate).then(res => {
                        console.log(res.data)
                        this.$Message.success("");

                    }).catch(err => {
                        console.log(err)
                    })

                }
            })
        },

/ / double-click the table assignment

        dblclickUpData(index) {
            console.log(index)
            this.formValidate = index;
        }

related codes

/ / Please paste the code text below (do not replace the code with pictures)

clipboard.png

what result do you expect? What is the error message actually seen?

May.07,2022

form elements are surrounded by v-if

Menu