1. v-bind: can bind some data to the attributes of the element<div id="app"> <p v-bind:title="message" v-bind:id="pId">I am a p tag</p> </div> <script src="./js/vue.js"></script> <script> let vm = new Vue({ el:"#app", data:{ message: "I am the title value of the p tag", pId: "This is a random ID" } }) The output is: 2. v-bind: can be abbreviated as: It is recommended to write the colon directly<div id="app"> <p :title="message" :id="pId">I am a p tag</p> </div> <script src="./js/vue.js"></script> <script> let vm = new Vue({ el:"#app", data:{ message: "I am the title value of the p tag", pId: "This is a random ID" } }) The output is the same as above 3. v-bind: splicing of instruction expressions,
Without quotes:
Add quotes: <p title="200" :title="message" :id="pId+'This is the additional id'">I am the p tag</p> Output: This is the end of this article about the use of You may also be interested in:
|
<<: CSS style does not work (the most complete solution summary in history)
>>: Example of customizing the style of the form file selection box
All blogs listed below are original and uniquely ...
Hexadecimal code table of various colors [Part 1] ...
When using nginx as a reverse proxy, you can simp...
Table of contents 1. Install Docker 2. Install so...
Use more open source tools such as docker and kub...
After setting the iframe's src to 'about:b...
Today we discussed the issue of what the margin v...
First, let’s take an example: There is a type fie...
The scope of css is global. As the project gets b...
In web page production, input and img are often pl...
Preface The delay of MySQL master-slave replicati...
Preface Under Linux, compilation and linking requ...
Friends who have some basic knowledge of SQL must...
Insert image tag <IMG> The colorful web page...
In MySQL, most indexes (such as PRIMARY KEY, UNIQ...