Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the ways of vue data binding

Shulou Source: shulou.com Published: 2022-06-02 05:11:13 09月11日 Update

This article mainly explains "what are the ways of vue data binding". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the ways of vue data binding"?

Vue data binding way: 1, with double curly braces "{{}}" to the page; 2, the use of "v-model", "v-text", "v-html", "v-bind" and other instructions; 3, tag attributes before the ":" binding; 4, the data before the splicing string with "${}".

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

Several ways of binding data by Vue

First, use double curly braces'{{}}'to give the data to the page

{{msg}} export default {data () {return {msg:' month has fallen crows cry autumn frost all over the sky',}

Second, use vue instruction

Export default {data () {return {msg:' month has fallen crows cry autumn frost all over the sky

V-model is used here to bind the value of the input box to msg, or v-text v-html v-bind, etc.

Third, add': 'binding to the tag attribute.

Export default {data () {return {msg:' month has fallen crows cry autumn frost',}

Bind the value of msg to the title of the cell cell through: title. If you forget to add':'in front of the title attribute, the page display will look like this:

The value given to title is not the variable msg in data () but the string "msg".

4. `${}` is used to concatenate strings before data.

Export default {data () {return {msg:' month has fallen crows cry autumn frost', color:'aqua'}

Thank you for reading, the above is the content of "what are the ways of vue data binding?" after the study of this article, I believe you have a deeper understanding of the way of vue data binding, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Data mode sky characters strings attributes pages learning content parentheses instructions tags units variables that is ideas situations tutorials articles more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MySQL MariaDB Docker Apple