zweizhao 7 лет назад
Родитель
Сommit
401b11e445
1 измененных файлов с 12 добавлено и 6 удалено
  1. 12 6
      pages/main/index/cert_edit.vue

+ 12 - 6
pages/main/index/cert_edit.vue

@@ -1,6 +1,7 @@
 <template>
   <div id="vip-setting">
     <el-form
+      v-if="ruleForm"
       label-position="right"
       label-width="80px"
       :model="ruleForm"
@@ -62,7 +63,7 @@
         ></quill-editor>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
+        <el-button type="primary" @click="submitForm">保存</el-button>
         <el-button type="primary" @click="clickCancel">取消</el-button>
       </el-form-item>
     </el-form>
@@ -70,6 +71,8 @@
 </template>
 
 <script>
+const ruleForm = 'ruleForm'
+
 export default {
   data() {
     return {
@@ -92,7 +95,7 @@ export default {
           ]
         }
       },
-      ruleForm: {},
+      ruleForm: null,
       rules: {
         name: [
           { required: true, message: '请输入中文', trigger: 'blur' },
@@ -173,14 +176,14 @@ export default {
     /**
      * 重置
      */
-    resetForm(formName = 'ruleForm') {
-      this.$refs[formName].resetFields()
+    resetForm() {
+      this.$refs[ruleForm].resetFields()
     },
     /**
      * 提交
      */
-    async submitForm(formName = 'ruleForm') {
-      this.$refs[formName].validate((valid) => {
+    async submitForm() {
+      this.$refs[ruleForm].validate((valid) => {
         if(valid) {
           let res = this.$post('/api/admin/cert/updateInfo', this.ruleForm)
             , data = res.data
@@ -215,6 +218,9 @@ export default {
         , res = await this.$post("/api/admin/cert/getDetail", { id })
         , data = res.data
       this.ruleForm = data
+      // this.$nextTick(() => {
+      //   this.$refs[ruleForm].validate()
+      // })
     },
   }
 }