Home  >  Article  >  Web Front-end  >  Analysis of the causes of syntax errors in binding HTML class arrays in Vue.js

Analysis of the causes of syntax errors in binding HTML class arrays in Vue.js

高洛峰
高洛峰Original
2017-01-12 13:09:411427browse

Vue.js binding HTML class array syntax error, the details are as follows:

It is a bit cumbersome to write like this when there are multiple conditional classes. In 1.0.19+, you can use object syntax in array syntax:

If you write it like this, it can be executed successfully, but there is an error

data: {
classA: 'class-a',
classB: 'class-b',
classC: 'class-c',
isB: true,
isC: false
}

Rendered as:

If it is a dash like class-b, it is unsuccessful, so you still need to use standard object syntax with quotes

Rendered as:

The above is the Vue.js binding HTML class array syntax error introduced by the editor. I hope it will be helpful to everyone. If you have any If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!

For more related articles analyzing the causes of syntax errors in Vue.js binding HTML class arrays, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn