webpack初始化项目:
vue init webpack projectName
配置打包的static路径使用相对 路径:
在config/index.js下
build: {
...
assetsPublicPath: './',
...
}
配置访问路径快捷方式:
build/webpack.base.conf.js
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'@static': resolve('static')
}
访问assets目录下文件:
<img class="light" :src="require('@/assets/common/light.png')" alt="">
background: url(~@/assets/dp/common/clue-key.png) no-repeat center;
访问static目录下文件:
<img class="person" src="static/imgs/person-white.gif"/>
<audio ref='ad' id='ad'>
<source src="static/audio/birthday.mp3" type="audio/mpeg">
</audio>
const textureLoader = new THREE.TextureLoader();
const bg = textureLoader.load(`static/imgs/bg1.jpeg`);// 3,5
const fLoader = new THREE.FontLoader();
const fPath = 'static/fonts/BBSGBSDGS_Regular.json';
fLoader.load(fPath, function(font) {
});