فهرست منبع

表单验证修改

wyq 4 سال پیش
والد
کامیت
ef497ec0c2
2فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 2 1
      src/components/knowledgeExtra/AddNewRuleTable.vue
  2. 1 1
      src/components/knowledgeExtra/rules.js

+ 2 - 1
src/components/knowledgeExtra/AddNewRuleTable.vue

@@ -158,13 +158,14 @@
         label="附加信息"
         v-if="showMsg || showMsg2"
       >
+      
         <template slot="header" slot-scope="scope">
           <div :class="showMsg?'custom_table_header':''">附加信息</div>
         </template>
         <template slot-scope="scope">
           <el-form-item
             :prop="`klRuleByIdSub[${scope.$index}].subMsg`"
-            :rules="showMsg?rules.subMsg:showMsg2?[]:rules.subMsgs"
+            :rules="showMsg?rules.subMsg:showMsg2?rules.subMsgs:[]"
             :class="scope.row.subMsg?'form-texarea':''"
             class="texarea-form"
           >

+ 1 - 1
src/components/knowledgeExtra/rules.js

@@ -45,7 +45,7 @@ export const tableRules = {
   subMsgs: [
     {
       validator: (rule, value, callback) => {
-        if (value.length > 100) {
+        if (value && value.length > 100) {
           callback(new Error("附加信息不能超过100字"));
         } else {
           callback();