问题描述:在列表渲染的时候,switchData 被触发,原因是冒号的问题,正确写法 :active-value=1 :inactive-value=-1 active-text="生效" inactive-text="失效"
<el-table-column width="240" label="操作" fixed="right" align="center" class-name="small-padding fixed-width"> <template #default="scope"> XXXX <el-switch v-model="scope.row.status" :width="50" @change="switchData($event, scope.row)" inline-prompt :active-value=1 :inactive-value=-1 active-text="生效" inactive-text="失效" /> </template> </el-table-column>