美文网首页
iview table组件里面render渲染的按钮如何阻止事件

iview table组件里面render渲染的按钮如何阻止事件

作者: Bior | 来源:发表于2020-04-07 22:51 被阅读0次

    vue 的官方文档上找到了render的解释 [事件 & 按键修饰符].
    render函数中 自带event事件,不用传参。不用写e,直接event.stopPropagetion()就可以了。

    {
                title: '中继',
                minWidth: 100,
                align: 'center',
                // key: '',
                render: (h, params) => {
                  let _this = this;
                  let linkListArray = params.row.linkList.split('|');
                  let buttonText = '';
                  if (linkListArray.length === 0 || (linkListArray.length === 1 && linkListArray[0] === '')) {
                    buttonText = '无';
                  } else {
                    buttonText = linkListArray.length + '级';
                  }
                  return h('i-button', {
                    props: {
                      type: 'info',
                      size: 'small'
                    },
                    on: {
                      click () {
                        event.stopPropagation();
                        _this.relayInfo.relayTargetDeviceCode = params.row.deviceCode;
                        _this.relayInfo.relayAreaId = params.row.areaId;
                        _this.relayInfo.currentDeviceLinkList = params.row.linkList;
                        _this.$refs.temporaryRelayModal.openModal();
                      }
                    }
                  }, buttonText);
                }
              }
    

    相关文章

      网友评论

          本文标题:iview table组件里面render渲染的按钮如何阻止事件

          本文链接:https://www.haomeiwen.com/subject/bhlaphtx.html