During development, when the data of el-form-item is circular, validation rules need to be added for each item, and only numbers and decimals can be entered

<el-row :gutter="20" v-if="enterprise.baseTopics.length ! = = 0">
  <el-col
    :span="12"
    v-for="(item, index) in enterprise.baseTopics"
    :key="index"
  >
    <el-form-item
      :label="item.name"
      :prop="`baseTopics.${index}.value`"
      :rules="[{trigger: 'blur', the pattern: / ^ [0-9] + (. [0-9] +)? $/, / / verification can only input the decimal and digital message: ` please enter a number or a decimal `,},]"
    >
      <el-input
        type="text"
        :placeholder="' Please enter '+ item.name"
        v-model="item.value"
      >
        <template slot="append">{{ item.unit }}</template>
      </el-input>
    </el-form-item>
  </el-col>
</el-row>
Copy the code