unplugin / unplugin-vue-components

📲 On-demand components auto importing for Vue
https://www.npmjs.com/package/unplugin-vue-components
MIT License
3.68k stars 342 forks source link

在hooks里调用组件失效,显示组件未注册 #647

Closed guohuihot closed 1 year ago

guohuihot commented 1 year ago

Describe the bug

这是最小实现,我不知道在这里提问对不对?也可能是unplugin-auto-import的问题 https://gitee.com/guohuihot/vue2.7_demo image

Reproduction

https://gitee.com/guohuihot/vue2.7_demo

System Info

System:
    OS: Windows 10 10.0.18362
    CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
    Memory: 6.68 GB / 11.92 GB
  Binaries:
    Node: 18.16.0
    Yarn: 1.22.17
    npm: 9.5.1
  Browsers:
    Edge: Spartan (44.18362.387.0)
    Internet Explorer: 11.0.18362.1

Used Package Manager

pnpm

Validations

guohuihot commented 1 year ago

@antfu

antfu commented 1 year ago

This plugin only works for template and have no plan to support JSX.

guohuihot commented 1 year ago

This plugin only works for template and have no plan to support JSX.

好吧,谢谢老板的回复

guohuihot commented 1 year ago

加上下面配置可以了,记录下

            include: [
              /\.vue$/,
              /\.vue\?vue/,
              /\.js$/,
            ],
gow1080p commented 1 year ago

加上下面配置可以了,记录下

            include: [
              /\.vue$/,
              /\.vue\?vue/,
              /\.js$/,
            ],

请教下你怎么在js里写jsx的

guohuihot commented 1 year ago

加上下面配置可以了,记录下

            include: [
              /\.vue$/,
              /\.vue\?vue/,
              /\.js$/,
            ],

请教下你怎么在js里写jsx的

@vue/babel-preset-jsx 装这个插件, 看我上面的demo/package.json里有