How to set up multiple Classes using Vue
Jun 12, 2018 pm 08:23 PMThis article mainly introduces the example code of using Vue to bind single or multiple Class names. It is very good and has reference value. Friends who need it can refer to it
一, Bind a single Class name in the form of a variable
Binding a single class name in vue is easy, just write it directly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
Use Vue to bind a single Class name
2. Bind multiple Class names in array form
For example, if we want to give Add a shadow to this p
Write the style in style
1 2 3 |
|
Continue to add data objects in data
1 2 3 4 5 6 7 8 9 10 11 |
|
Bind the Class name in the form of an array in the tag
1 2 3 4 5 |
|
It’s OK.
Bind multiple Class names in array form
3. Bind multiple Class names in json form
This method is convenient for determining which style to display when adding multiple Class names at the same time.
Write the style first
1 2 3 4 5 6 7 8 9 10 |
|
Add a digital object to the data for judgment
1 2 3 4 5 6 7 8 9 10 11 |
|
Bind it to the class in the form of json, and change the values of show1 and show2 through Boolean values to control the status of p
1 2 3 4 5 |
|
Use json form to bind multiple Classes
ps: vue solves cross-domain problems
Change config /index.js file
1 2 3 4 5 6 7 8 |
|
The above is all the content I summarized, I hope it will be helpful to everyone
Related articles:
How to implement multiplexing in JavaScript Inherit
About how Wangwang online customer service implements
How to implement web mouse special effects (detailed tutorial)
The above is the detailed content of How to set up multiple Classes using Vue. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The difference between event and $event in vue

The difference between export and export default in vue

Onmounted in vue corresponds to which life cycle of react
