一、首先安装对应的插件(前往查看model-viewer)
# install peer dependency ThreeJS
npm install three
# install package
npm install @google/model-viewer
二、页面直接引用组件(例子)
<model-viewer style="width: 500px;height: 500px;margin: auto;" alt="Ready Player Me Avatar" camera-controls
src="https://cdn.glitch.com/36cb8393-65c6-408d-a538-055ada20431b/Astronaut.glb?1542147958948" shadow-intensity="1"
touch-action="pan-y">
</model-viewer>
import ModelViewer from '@google/model-viewer' //引入组件
components: {
ModelViewer
},