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)
        })
    },
Logo

前往低代码交流专区

更多推荐