javascript - Can !important be used without any scruples after using scoped in vue.js component style?
大家讲道理
大家讲道理 2017-05-18 10:54:09
0
5
718

Thinking that after using scoped, the styles between components will not affect each other, then when I override the style of the component in the component library, is it reasonable to use !important in my current component (because the style nesting layer of the header component in the component library Number of depths, using deeper levels is always easier than using !important)Please give me some advice

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all (5)
曾经蜡笔没有小新

It is recommended not to use !important as much as possible. If you use it, you will enjoy development for a while, but later maintenance will not be so satisfactory. There is a class in the outer layer of the component template, and the weight is enough.

    大家讲道理

    It is strongly recommended not to use !important. In addition, nesting should be used as little as possible, which will affect performance. I would rather write more classes

      漂亮男人

      Scoped has placed the only restriction on the component. Using important will only affect the content in the component. It doesn’t matter whether you use it or not

        刘奇

        scoped is to add a random prefix to the css in the component. All css affected by that random prefix can be used with confidence! important

          世界只因有你

          !Impotant should not be used unless absolutely necessary. It is really a dangerous thing.

          Although scoped has restricted the style to only take effect on elements within the component, problems may also occur within the same component. For example, if you use !important in a relatively large component, problems may occur during future expansion, modification, and maintenance. Son. After all, as time went by, I forgot about this matter.

          Of course, if you want to say that you will never forget it, even if it means important, that’s fine. It’s just that you have to write a few more characters for no reason, which is so painful. People like me usually roll around every time I write an extra semicolon. I can't stand it. Adding one more !important means 10 characters, five bytes, and 200 million visits waste a gigabyte of traffic. What a waste, isn't it? :)

            Latest Downloads
            More>
            Web Effects
            Website Source Code
            Website Materials
            Front End Template
            About us Disclaimer Sitemap
            php.cn:Public welfare online PHP training,Help PHP learners grow quickly!