在你的el-switch 组件上加 @click.stop.native 就可以阻止冒泡啦为了防止我误导,我本地验证了一下可行性,哈哈哈~ <template> <el-table :data="tableData" @row-click="rowClick"> <el-table-column label="序号" prop="id" align="center"></el-table-column> <el-table-column label="发布状态" align="center"> <template slot-scope="scope"> <el-switch v-model="scope.row.status" @change="handleStateChange(scope.row)" @click.stop.native> </el-switch> </template> </el-table-column> </el-table> </template> <script> export default { name: 'test', data () { return { tableData:[{ id:1, status:1 },{ id:2, status:0 }] } }, methods: { handleStateChange(row){ console.log(row.status) }, rowClick(){ console.log('rowClick') } } } </script>
在你的el-switch 组件上加
@click.stop.native
就可以阻止冒泡啦为了防止我误导,我本地验证了一下可行性,哈哈哈~