iview table中使用radio的单选(iview 表格单选按钮功能的实现)

第一步先定义个

currentid:0

然后

{
            title: '选择',
            key: 'chose',
            width: 70,
            align: 'center',
            render: (h, params) => {
              let id = params.row.idjishi;
              let flag = false;
              if (this.currentid === id) {
                flag = true
              } else {
                flag = false
              }
              let self = this
              return h('div', [
                h('Radio', {
                  props: {
                    value: flag
                  },
                  on: {
                    'on-change': () => {
                      self.currentid = id
                      this.id_jishi = params.row.idjishi
                    }
                  }
                })
              ])
            }
          },

猜你喜欢

转载自blog.csdn.net/qq_41994549/article/details/86063165