美文网首页
Element table组件columns在组件外部定义时,c

Element table组件columns在组件外部定义时,c

作者: 塞风 | 来源:发表于2021-12-17 09:30 被阅读0次

    发现

    由于页面columns比较多,于是单独写了个columns.js导出genColumns方法,genColumns返回columns list。其中少不了列需要用链接渲染,发现了使用jsx报错:

    columnItem.png 异常.png

    解决方法

    在data|created|mounted|computed中使用genColumns并传入this,比如this.columns = genColumns(this),在columns.js中:

    export function genColumns(context) {
      const h = context.$createElement
      return [ ... ]
      }
    

    参考链接

    相关文章

      网友评论

          本文标题:Element table组件columns在组件外部定义时,c

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