vue public 引入静态文件的打包路径方法
在 vue.cofing.js 中配置
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
publicPath:process.env.NODE_ENV === "production"?'/static/manual/':'',
devServer: {
proxy: {
'/essay': {
target: 'https://beta-kmg.goms.com.cn/',
// target: 'https://daisy-group-api.goms.com.cn/',
changeOrigin: true,
},
'/beta_server': {
target: 'https://acdm-shenzhen.oss-cn-shenzhen.aliyuncs.com/',
changOrigin: true,
},
}
},
})
引用路径
data () {
return {
defaultActive: '1-0',
pageCount: 0,
numPages: 0,
src: '',
menuLists: [
],
publicPath: process.env.BASE_URL,
}
},
this. publicPath+"cmaps/"

浙公网安备 33010602011771号