iview 数据表格中 按钮操作自定义(启用停用切换)

        let stausName = null
        let stausColor = null
        if(params.row.supplierStatus === 1){
          stausName = '启用'
          stausColor = 'success'
        }else{
          stausName = '停用'
          stausColor = null
        }
        renderData.push (
          h('Button', { // 状态
            props: {
              type: stausColor,
            },
            style: {
              cursor: 'pointer',
              marginRight: '10px'
            },
            on: {
              click: () => {
                _this.chooseListData = []
                _this.chooseListData.push(params.row)

                const objData = _this.$refs.tables.$refs.tablesMain.objData
                const objDataArray = Object.getOwnPropertyNames(objData)

                objDataArray.forEach(item => {
                  objData[item]._isChecked = false
                })
                objData[params.index]._isChecked = true
                _this.btnChangeEnableDisable(params.row)
              }
            }
          }, stausName )
        )


minxi.js 写btnChangeEnableDisable这个方法,传递参数给btnChangeEnableDisable,在minxi.js里发送请求即可



 

你可能感兴趣的:(iview)