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

全局引入了reset样式 #586

Closed
tzz722 opened this issue Sep 24, 2019 · 5 comments
Closed

全局引入了reset样式 #586

tzz722 opened this issue Sep 24, 2019 · 5 comments

Comments

@tzz722
Copy link

tzz722 commented Sep 24, 2019

a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: initial;
}
从1.x升级到2.x之后会在全局引入这个样式 能不能移动到每个组件的命名下面

@xxyan0205
Copy link
Collaborator

能不能移动到每个组件的命名下面

之前有考虑过,但是这样选择器部分会变得非常长,目前有遇到什么问题么?

@tzz722
Copy link
Author

tzz722 commented Sep 24, 2019

打包完成之后这个样式覆盖掉了项目写的body样式
body
font-family "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif!important
font-size 28px!important
color blackFontColor1A!important
word-break break-all!important
比如我在全局定义了默认的字体大小 现在必须要加!important才能使用了

@tzz722
Copy link
Author

tzz722 commented Sep 24, 2019

作为组件引入,却能影响到全局的样式这是不太合适的

@xxyan0205
Copy link
Collaborator

xxyan0205 commented Sep 24, 2019

作为组件引入,却能影响到全局的样式这是不太合适的

这个问题之前在另一个issue中讨论过,的确是有一定的侵入的问题,之前没有内置reset样式,但导致有不少用户不知道该如何处理相关样式。在这二者之间我们只能做权衡,尽量的以最少的侵入,最少的代码,最大的减少用户的使用困扰。

我们会在后面迭代中先把margin, padding以外的样式去掉。另外也建议业务的全局样式引入尽量在第三方之后。

@tzz722 tzz722 closed this as completed Sep 24, 2019
@Marinerer
Copy link

我们会在后面迭代中先把margin, padding以外的样式去掉。另外也建议业务的全局样式引入尽量在第三方之后。

建议全局样式放在 index.css 文件里引入,这样对页面其他样式影响会更小。

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

3 participants