vue3使用pug时,具名插槽解析错误?

vue: "3.3.4"
pug: "3.0.2"

只有具名插槽报错,默认的正常

ToolBar
    .sys_btns
        template(#end)
            span 123

ToolBar

...
slot(name="end")
...

报错:

[plugin:vite:vue] Codegen node is missing for element/if/for node. Apply appropriate transforms first.

网上能找到的方法都试了,没用。如下:

template(#end="")
template(v-slot:end)
template(v-slot:end="")
<template v-slot:end>xxx</template>

还有一个不知道怎么用:

globals: {
    'vue-jest': {
      pug: { doctype: 'html' }
    }
  }
阅读 5.2k
1 个回答
template(v-slot:end)
  span 123

即可。

解决这个问题很简单,找个 pug 输出 html,看怎样能满足 vue 的要求 就好。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题