vue css 中使用static中的图片

    科技2024-08-15  31

    css中 background-image: url(/static/images/xxx.png);

    .m_img { background-repeat: no-repeat; cursor: pointer; height: 32px; margin: auto; overflow: hidden; width: 32px; background-image: url(/static/images/xxx.png); }

    config/index.js中的配置

    dev: { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {} ... }, build: { // Template for index.html index: path.resolve(__dirname, '../dist/index.html'), // Paths assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/二级域名/' ... }

     

    Processed: 0.009, SQL: 8