v-if不加会出错
<el-dialog :title="title" :visible.sync="shareDialogVisible" v-if="shareDialogVisible" width="30%">
<el-form ref="form" :model="form" :rules="rules" label-width="33%" >
<el-form-item label="状态:" prop="ifEnabled">
<el-col :span="22">
<el-select class="w" v-model="form.ifEnabled" placeholder="请选择状态">
<el-option
v-for="item in optionsStatus"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-col>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button class="mr10" @click="shareDialogVisible=false">取 消</el-button>
<el-button type="primary" @click="submitForm('form')">确 定</el-button>
</span>
</el-dialog>
created() {
this.formCopy=JSON.parse(JSON.stringify(this.form))
},
// 新增或编辑
async handleClick(row) {
let that = this;
if (row) {
this.title = "编辑";
console.log(row)
this.form=row;
} else {
this.title = "新增";
this.form=JSON.parse(JSON.stringify(this.formCopy))
}
this.shareDialogVisible = true;
},