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
Introduction By enabling the slow query log, MySQ...
Table of contents Overview Code Implementation Pa...
//Default protocol /The use of the default protoc...
Cooper talked about the user's visual path, w...
The best thing you can do for your data and compu...
The following are its properties: direction Set th...
For databases that have been running for a long t...
With the popularization of 3G, more and more peop...
The methods of installing nginx and multiple tomc...
I recently bought a Tencent Cloud server and buil...
This article shares the specific code for the WeC...
<body> <div id="root"> <...
Problem description: After the front-end deletes ...
We usually use the <ul><li> tags, but ...
Table of contents What is virtual dom? Why do we ...