其他分享
首页 > 其他分享> > Vue2.x Class & Style Bindings

Vue2.x Class & Style Bindings

作者:互联网

Intoduciton: The way of using '' in html part confused me when I was learning Class&Style Bindings in Vue's official guide.(of course it's also because of my weak foundation). To help newcomer understand, Vue's official guide seemed a little lengthy. So I decided to reorganize them.

The follow content won't contain many examples, you can click the superlink above to see the official guide's.

Binding Inline Styles

In my opinion, key is a pointer, which means we could save the content in somewhere and use them flexibly. In some sense, class is a pointer of style. So I'd like to introduce style firstly.

Basic syntax

  data: {
    data-key-styleObject: {
      color: 'red',
      fontSize: '13px'
    }
  }

Advanced

Binding HTML Classes

As I said before, class is pointer of style. The diffrence is that class is found in <style> while data-key is found in <script>.

Basic syntax

Advanced

标签:Style,name,Object,style,Class,key,Bindings,data,class
来源: https://www.cnblogs.com/sagekwun/p/14398224.html