[英]Errors while using Vue CLI 4 and A Frame
我一直在嘗試使用 Vue cli 4.2.3 和 aframe.io 開發一個 VR 網絡應用程序,並且收到了很多類似這樣的錯誤消息,用於所有 aframe 的組件
[Vue warn]: Unknown custom element: <a-scene> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
[Vue warn]: Unknown custom element: <a-cursor> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
這是我的 main.js 代碼
import Vue from 'vue'
import App from './App.vue'
import 'aframe';
new Vue({
el: '#app',
render: h => h(App)
})
為方便起見,我將只寫出我所參考的鏈接。 兩者都有完全相同的代碼
https://github.com/nobu222/aframe-vue-sample/blob/master/src/App.vue
https://github.com/nobu222/aframe-vue-sample/blob/master/src/Entity.vue
請幫幫我。 這東西真讓我頭疼
答案是這些蛇殼中的組件與 Vue 發生了沖突。 Vue 找不到那些注冊的組件,所以你會得到你所做的錯誤。
簡而言之:告訴Vue
ignoreElements
與a frame
關聯的ignoreElements
:
Vue.config.ignoredElements = [
'a-scene',
'a-entity',
'a-camera',
'a-box',
'a-sky',
'a-sphere',
'a-cylinder',
'a-plane'
];
上面的列表並不全面,但只是一個起點。 您可以根據需要添加更多或從中減去。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.