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/"
 
 
 
 
posted @ 2022-06-28 16:47  踏浪小鲨鱼  阅读(1079)  评论(0)    收藏  举报