Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

组件样式好像不生效啊。是要配置什么东西么? #7

Closed
pcloth opened this issue Mar 9, 2018 · 6 comments
Closed

组件样式好像不生效啊。是要配置什么东西么? #7

pcloth opened this issue Mar 9, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@pcloth
Copy link

pcloth commented Mar 9, 2018

如题。
在vue init mpvue/mpvue-quickstart my-project新建的项目里,组件card的class name能正确,但是样式丢失了。是要配置什么东西么?

@aOrz
Copy link
Member

aOrz commented Mar 9, 2018

暂不支持在组件引用时,设置组件级别的 class,例

@aOrz aOrz closed this as completed Mar 9, 2018
@F-loat
Copy link
Contributor

F-loat commented Mar 9, 2018

@aOrz 同样发现了这个问题,看了下生成的代码里,组件内的 css 样式被提取到了 vendor.wxss 中,但并未被任何文件引用,导致样式丢失

@aOrz aOrz added the bug Something isn't working label Mar 9, 2018
@aOrz
Copy link
Member

aOrz commented Mar 9, 2018

@F-loat 稍后会修复这个bug,你可以先改下webpack 配置 webpack.*.conf.js 中

new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor',
      minChunks: function (module, count) {
        // any required modules inside node_modules are extracted to vendor
        return (
          module.resource &&
          /\.js$/.test(module.resource) &&
          module.resource.indexOf('node_modules') >= 0
        ) || count >= 2
      }
    }),

new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor',
      minChunks: function (module, count) {
        // any required modules inside node_modules are extracted to vendor
        return (
          module.resource &&
          /\.js$/.test(module.resource) &&
          module.resource.indexOf('node_modules') >= 0
        )
      }
    }),

避免 css 打到 vendor.wxss 中

@aOrz aOrz reopened this Mar 9, 2018
@F-loat
Copy link
Contributor

F-loat commented Mar 9, 2018

好的,就是去掉 || count >= 2 就可以吧,那暂时先就这么解决了😃

@mcu13321
Copy link

mark

@aOrz
Copy link
Member

aOrz commented Mar 22, 2018

@mcu13321 参考最新的 quickstart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants