问题:
在vue3 Element-puls 中 初始化的时候@change会自动被调用
解决方案:
使用 :beforeChange 这个属性 但是这个属性不能直接传值 如果直接传值依然会自动调用,需要使用自执行函数来****传值
<el-switch :before-change="()=>switchBeforeChange(scope.row)" v-model="scope.row.isValid" size="small" active-text="有效" :active-value="1" :inactive-value="0" inactive-text="无效" />........... const switchBeforeChange=(row)=>{ console.log('row') return new Promise((resolve) => { setValid(row) return resolve(true) })}