账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vue-cli3创建的项目在vue.config.js文件中一旦配置css属性,就无法引入第三方ui框架的css文件
    42
    0
    • 用vue-cli3搭建创建的项目,创建时选择的preset为vue-router,vuex,sass,babel,es
    • vue.config.js配置如下
    module.exports = {
      outputDir: 'dist/umall',
      publicPath: './',
      runtimeCompiler: true,
      productionSourceMap: false,
      css: {
        modules: true,
        sourceMap: false,
        loaderOptions: {
          sass: {
            data: `@import "@/assets/reset.scss";`
          },
          postcss: {
            plugins: [
              require('postcss-import'),
              require('postcss-px-to-viewport')({
                'viewportWidth': 375, // (Number) The width of the viewport.
                'viewportHeight': 667, // (Number) The height of the viewport.
                'unitPrecision': 3, // (Number) The decimal numbers to allow the REM units to grow to.
                'viewportUnit': 'vw', // (String) Expected units.
                'selectorBlackList': ['.ignore', '.hairlines'], // (Array) The selectors to ignore and leave as px.
                'minPixelValue': 1, // (Number) Set the minimum pixel value to replace.
                'mediaQuery': false // (Boolean) Allow px to be converted in media queries.
              })
            ]
          }
        }
      },
      devServer: {
        open: true,
        disableHostCheck: true
      },
      parallel: require('os').cpus().length > 1
    }

    出现的问题: 无法引入vant-ui的css文件,如果将vue.config.js中的css配置项注释掉,就可以引入vant-ui的css了,不懂vue-cli是如何处理的?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部