el-switch接口实现

后台返回的数据: 

active-textswitch 打开时的文字描述string
inactive-textswitch 关闭时的文字描述string
active-valueswitch 打开时的值boolean / string / numbertrue
inactive-valueswitch 关闭时的值boolean / string / numberfalse
active-colorswitch 打开时的背景色string#409EFF
inactive-colorswitch 关闭时的背景色string#C0CCDA
 <el-table-column header-align="center" align="center" label="状态" prop="state">
            <template slot-scope="scope">
              <el-switch
                v-model="scope.row.state"
                active-text="打开"
                inactive-text="关闭"
                :inactive-value="0"
                :active-value="1"
                active-color="#1890ff"
                inactive-color="#c0c0c0"
                @change="addOrUpdateHandle('stateDesc',scope.row)"
              ></el-switch>
            </template>
</el-table-column>
      //修改状态
      if (type == "stateDesc") {
        let status = item.stateDesc == 1 ? "打开" : "关闭";
        this.$confirm(`是否${status}?`, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            post("/xxxx/event/project/state", {
              id: item.id, //后台要的参数
              state: item.state //后台要的参数
            }).then(res => {
              console.log(res, "状态");
              this.projectlist(); //重新加载列表
            });
          })
          .catch(() => {});
      }

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值