Vue——v-if控制元素是否显示
show.vue文件如下:<el-table-column label="状态"><template slot-scope="scope"><el-buttonv-if="show":loading="true"type="danger"...
·
show.vue文件如下:
<el-table-column label="状态">
<template slot-scope="scope">
<el-button
v-if="show"
:loading="true"
type="danger"
plain
@click="handleDelete(scope.$index, scope.row)">监控中</el-button>
<el-button
v-if="show1"
type="success"
plain
@click="handleDelete(scope.$index, scope.row)">监控已关闭</el-button>
</template>
</el-table-column>
<script> 进行按钮状态的切换
closeDevice() {
axios.get('http://localhost:3000/closeDevices')
.then((response) => {
console.log('close mqtt client')
this.show = false
this.show1 = true
})
.catch(function(error) {
console.log(error)
})
},
更多推荐
已为社区贡献6条内容
所有评论(0)