![](/img/trans.png)
[英]Vuejs - Failed to mount component: template or render function not defined
[英]VueJS error: "Failed to mount component: template or render function not defined"
我很難理解 VueJS 中的組件和模板系統。 我下載了VuetifyJS PWA 示例模板,並嘗試將Hello.vue的完整內容替換為 VuetifyJS google-contacts.vue示例模板的內容。 在localhost:8080
上npm run dev
后,我收到此錯誤消息:
> vue.esm.js?65d7:578 [Vue warn]: Failed to mount component: template or render function not defined.
found in
---> <Hello> at /home/a/my-project/src/components/Hello.vue
<App> at /home/a/my-project/src/App.vue
<Root>
為什么不能只替換<template></template>
內容,我需要更改什么才能使用google-contacts.vue模板內容而不是Hello.vue內容?
我只是按照這個過程,它對我來說沒問題,所以我猜這很可能是你構建中的一個錯誤步驟,但到目前為止無法重現它。
注意,看起來docs/examples/layouts/google-contacts.vue是對整個頁面布局的替代,而不是一個單獨的組件(沿着@B.Fleming 在評論中提到的思路思考),因此更適合替代App.vue
比Hello.vue
。
這就是我最初所做的(沒有徹底閱讀您的帖子)。 但隨后替換Hello.vue
給了我相同的工作谷歌聯系人頁面。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.