点击button时请求数据成功之后, 需要把button中的value改变, 自己是通过this.$refs来改变value的值和配合this.$nexttick事件来操作, 但是都不起效果
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<button ref="releaseStatus" class="detach_btn" @click.prevent="issuePatrolPlan(scope.$index, scope.row)">发布</button>
</template>
</el-table-column>
// 发布
issuePatrolPlan(index, row) {
this.$confirm("是否确定发布该计划?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http.put(this.$api.planPublish + row.id).then(res => {
this.initPatrolPlan();
this.$message({
type: "success",
message: "发布成功!"
});
console.log("row", row);
// 发布成功之后改变button的value
row.published == "已发布"
? (this.$refs.releaseStatus.innerText = "取消")
: (this.$refs.releaseStatus.innerText = "发布");
console.log('this.$refs.releaseStatus.innerText', this.$refs.releaseStatus.innerText);
// 调用初始化的数据
this.initPatrolPlan();
});
});
},
未点击发布button时
点击发布button后打印数据
当再次进行刷新页面, 最后一条的button的value也变回发布了