ivew table 模板中使用i-switch
<template slot-scope="{ row, index }" slot="zhuangtai"> <i-switch @on-change="change($event, row)" :value="row.releaseStatus" /> </template>
模板部分
{ title: '发布状态', slot: 'zhuangtai', key: 'counter', minWidth: 180, }
async change($event, input) { this.loadingStatus.tableLoading = true; input.releaseStatus = !input.releaseStatus; await updateItem({ data: input }); this.fetchData(); },
代码部分
漫思