我在Vue3中使用A-frame1.5和handtrackjs遇到问题

问题描述 投票:0回答:1

我想在vue3中使用aframe1.5和handtrack.js,但我在浏览器中收到错误“无法解析组件:a-camera;无法解析组件:a-scene”

这好像是aframe注册的问题,不过我已经尝试解决很久了-。- 如果有人可以帮助我,我将非常感激👋 code in main.tscode in Vue page

vuejs3 aframe
1个回答
0
投票

是我对Vue不熟悉。
由于 a-frame 的元素是直接在窗口中注册的,Vue 无法正确解析它们。
所以我们需要从 Vue 的组件解析中跳过所有 a-frame 元素。
像这样:

// in vite.config.ts
plugins: [
  vue({
  template: {
    compilerOptions: {
      isCustomElement: (tag) => tag.includes('a-') 
     } 
   } 
  })
  //...
]

© www.soinside.com 2019 - 2024. All rights reserved.