VUE项目
vue-cli
加载obj
obj文件存放位置 public/static
vue 引入obj
控件:Vue-3D-Model
安装:npm install vue-3d-model
<!-- ThreeDCity.vue文件 -->
<template>
<div class="ThreeJSCity">
<model-obj class="ThreeDShow" :src="`/static/models/study.obj`"></model-obj>
<!-- <img src="@/assets/models/test.png" /> -->
</div>
</template>
<script src="./_ThreeDCity.js" lang="js"></script>
<style src="./_ThreeDCity.less" lang="less" scoped></style>
<!-- _ThreeDCity.less文件 -->
.ThreeJSCity {
width: 100%;
height: 100%;
.ThreeDShow {
width: 100%;
height: 100%;
}
}
<!-- _ThreeDCity.js文件 -->
import { ModelObj } from 'vue-3d-model'
export default {
name: 'ThreeDCity',
components: {
ModelObj
},
mixins: [],
props: {},
data () {
return {}
},
computed: {},
watch: {},
created () {},
methods: {}
}
简单的引入即可完成