element-ui 的 el-table里面的input 正则验证为什么不成功?

怎么对里面的两个el-input进行验证

原本的代码:

     <el-table :data="groupSalesPriceTableDetail.relExtList"  border">    
                <el-table-column align="center" width="200" >
                    <template slot-scope="scope">
                        <el-input  v-model="scope.row.formulaMolecule"></el-input>
                        <span>/</span>
                        <el-input  v-model="scope.row.formulaDenominator"></el-input>
                    </template>
            </el-table-column>
     </el-table>
   

我改后的代码:

            <el-table-column align="center" width="200" label="单位转换基数" show-overflow-tooltip>
                    <!--<template slot-scope="scope" >-->
                        <!--<el-input style="width:40px!important;" v-model="scope.row.formulaMolecule"  :disabled = 'scope.row.outerMaterialName==""' ></el-input>-->
                        <!--<span>/</span>-->
                        <!--<el-input style="width:40px!important;" v-model="scope.row.formulaDenominator"  :disabled = 'scope.row.outerMaterialName==""' ></el-input>-->
                    <!--</template>-->
                    <template slot-scope="scope">
                        <el-form :model="scope.row" :rules="checkParamsRule" ref="scope.row">
                            <el-form-item prop="formulaMolecule">
                                <el-input v-show="true"  v-model="scope.row.formulaMolecule"></el-input>
                            </el-form-item>
                        </el-form>
                    </template>
                </el-table-column>
                

js部分:

    data() {
        var validateValueInput = (rule, value, callback) => {
            console.log(1);
        }
        return {
      
            groupSalesPriceTableDetail:{},
            checkParamsRule:{
                paramValue:[
                    { validator: validateValueInput, trigger: 'blur' }
                ],
            },
        }                
阅读 3.7k
2 个回答

一样的 表格外面套一个form 就是有些自定义的验证的话可能就需要用render写了

el-table 没指定data,scope.row 应该是undefined,然后ref 绑定应该是字符串,而不是对象

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题