美文网首页
vscode & element-ui-table-templa

vscode & element-ui-table-templa

作者: donotlb | 来源:发表于2019-02-01 11:12 被阅读0次
<el-table :data="list">
  <el-table-column label="静态内容">
    <template scope="scope">
      static content
    </template>
  </el-table-column>
  ...
</el-table>

上面这段代码在 vscode 编辑器中会出现错误提示, 如图:

image.png

解决办法是把 scope="scope" 改为 scope="{}", 如图:

<el-table :data="list">
  <el-table-column label="静态内容">
    <template scope="{}">
      static content
    </template>
  </el-table-column>
  ...
</el-table>

注意: 如果把 scope="{}" 写成 scope="", vscode 倒是不报警告了, 但经测试发现内容不会被渲染, 所以一定要这样写: scope="{}"

参考: https://github.com/vuejs/eslint-plugin-vue/issues/781

相关文章

网友评论

      本文标题:vscode & element-ui-table-templa

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