iview tabs里面放入 i-switch slot的写法

简介: iview tabs里面放入 i-switch slot的写法
        {
          'title': '状态',
          'key': 'status',
          render: (h, params) => {
            return h(
              'i-switch',
              {
                props: {
                  trueValue: 1,
                  falseValue: 0,
                  beforeChange: () => {
                    // if (status === 0)
                    console.log(params.row.status)
                    if (params.row.status === 1) {
                      console.log('000')
                      return new Promise((resolve) => {
                        this.$Modal.confirm({
                          title: '确认停用',
                          content: '停用商品后,该商品将不允许继续被选择,但不影响当前售卖。如果希望取消商品售卖,请在售货机详情中进行操作。',
                          onOk: () => {
                            this.changeStatus(params.row.status, params.row.id)
                          }
                        })
                      })
                    } else {
                      console.log('111')
                      this.changeStatus(params.row.status, params.row.id)
                    }
                  },
                  value: Number(params.row.status),
                  size: 'large'
                }
              },
              [
                h('span', {
                  slot: 'open'
                }, '启用'),
                h('span', {
                  slot: 'close'
                }, '停用')
              ]
            )
          }
        },
    render:(h,params)=>{
        return h('i-switch',{
            props:{
                value:params.row.status
                size:'large'
            },
            scopedSlots:{
                open:()=>h('span','开启'),
                close:()=>h('span','停用')
            }
        })
    }

相关文章
16avalon - 指令ms-attr(属性绑定)
16avalon - 指令ms-attr(属性绑定)
69 1
layui嵌套弹出模态框的Blocked a frame with origin null from的解决方案
layui嵌套弹出模态框的Blocked a frame with origin null from的解决方案
179 0
|
JavaScript
element-ui(vue版)使用switch时change回调函数中的形参传值问题
element-ui(vue版)使用switch时change回调函数中的形参传值问题
150 0
|
前端开发
26avalon - 指令ms-duplex(各表单元素用法)
26avalon - 指令ms-duplex(各表单元素用法)
48 1
|
JavaScript
vue项目在点击重复路由时报错(NavigationDuplicated: Avoided redundant navigation to current location)
vue项目在点击重复路由时报错(NavigationDuplicated: Avoided redundant navigation to current location)
116 2
|
JavaScript
vue项目router报NavigationDuplicated: Avoided redundant navigation to current location: “/result/3“错误
vue项目router报NavigationDuplicated: Avoided redundant navigation to current location: “/result/3“错误
52 0
vue项目router报NavigationDuplicated: Avoided redundant navigation to current location: “/result/3“错误
35avalon - 指令ms-widget(组件绑定介绍)
35avalon - 指令ms-widget(组件绑定介绍)
31 0
【element-ui用法】el-radio-group默认选择和数据回显问题的解决方案
【element-ui用法】el-radio-group默认选择和数据回显问题的解决方案
729 0
|
小程序
【微信小程序】tabbar报错Component is not found in path “custom-tab-bar/index“
【微信小程序】tabbar报错Component is not found in path “custom-tab-bar/index“
421 0