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

样式问题 #14

Closed
xiaoggaiwo opened this issue Jul 3, 2020 · 2 comments
Closed

样式问题 #14

xiaoggaiwo opened this issue Jul 3, 2020 · 2 comments

Comments

@xiaoggaiwo
Copy link

你好,我想问下,我通过把jigsaw.js文件以及同文件夹内的jigsaw.css两个文件一起copy到自己项目中,并且在js文件内修改导出方式
// window.jigsaw = {
// init: function (opts) {
// return new Jigsaw(opts).init()
// }
// };
let ptOption = {
init: function (opts) {
return new Jigsaw(opts).init()
}
};
export default ptOption;
引用方式是在vue页面中import jigsaw.js文件然后在mounted中 jigsaw.init一样的配置方式后。发现在自己项目中的jigraw__xxxx--ccc的样式全部变成undefined。样式全部不生效。这个该怎么调整。我看你像是在webpack中配置。我感觉不能按你这原样的webpack配置,不然整个项目都挂了。
我想问:1,我该怎么调整这样加载能正常对应载入,2,这样式能改成不通过webpack这样配置吗,直接在js中对应的配置引入啥的

@yeild
Copy link
Owner

yeild commented Jul 3, 2020

这里用了css modules防止样式类名冲突,你把import styles from './jigsaw.css' 改成 import './jigsaw.css
image

然后这几处styles[className] 改成className应该就可以了
image

@xiaoggaiwo
Copy link
Author

真的是,我自己测试css modules一直报错不行,到现在还奇怪一样有安装style-loader跟css-loader怎么就不行了,webpack中的.css$规则配置一样的,只要有加css-loader跟style-loader加载就报错。后面尝试把styles[className]全部替换成className就可以了。

@yeild yeild closed this as completed Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants