Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component is missing template or render function #1

Closed
yexiaodong opened this issue Mar 9, 2021 · 15 comments
Closed

Component is missing template or render function #1

yexiaodong opened this issue Mar 9, 2021 · 15 comments

Comments

@yexiaodong
Copy link

runtime-dom.esm-bundler-bda63781.js:1184 [Vue warn]: Component is missing template or render function.
at <Anonymous value= {name: "qiu", age: 18, isMan: false, date: Tue Mar 09 2021 16:02:54 GMT+0800 (GMT+08:00), fn: ƒ, …} copyable="" boxed="" ... >
at <PluginJson onVnodeUnmounted=fn ref=Ref< undefined > class="page" >
at
at
at

@qiuquanwu
Copy link
Owner

这个只能在vue3中使用

@yexiaodong
Copy link
Author

就是vue3,用vite1搭建的

@qiuquanwu
Copy link
Owner

可以看看你的代码吗?就是使用这个组件的部分

@yexiaodong
Copy link
Author

@qiuquanwu
Copy link
Owner

没看到在哪里引用了啊

@yexiaodong
Copy link
Author

src/module/alpha/views/PluginJson.vue

@yexiaodong
Copy link
Author

image

@qiuquanwu
Copy link
Owner

看到了,你可以用vue3的写法试试

@qiuquanwu
Copy link
Owner

你在mian.js使用app.use注册组件试试,

@yexiaodong
Copy link
Author

刚刚试了你的方法,一样有这个错误(PS:我使用局部导入组件,非全局导入)

@qiuquanwu
Copy link
Owner

这个我倒是没试过,我有时间试试,看看什么问题

@yexiaodong
Copy link
Author

可以了,你的组件必须在main.js中全局导入

@yexiaodong
Copy link
Author

可以优化一下吗,因为这个组件不常用,不想全局导入

@qiuquanwu
Copy link
Owner

qiuquanwu commented Mar 11, 2021

vue3有些不一样,你可以在组件内引用,但是你标签名得用JsonViewer,你用vue3最好还是用vue3的写法,使用compositionAPI+script-setup

@qiuquanwu
Copy link
Owner

close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants