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
Table of contents Preface text 1. Closure 1.1 Wha...
1. forEach() is similar to map(). It also applies...
1 MySQL autocommit settings MySQL automatically c...
Table of contents Configuration nfs server (nfs.s...
Today's article mainly introduces the reload ...
This article shares the specific code for WeChat ...
Table of contents 1. Scene loading 2. Find Node 1...
Table of contents Preface preparation Go! text St...
A mature database architecture is not designed wi...
Setup is used to write combined APIs. The interna...
Preface Due to the weak typing of JS, loose writi...
Table of contents Review of Object.defineProperty...
Table of contents Initialization of echart app-ba...
Table of contents Modify the repository source st...
MySQL Introduction to MySQL MySQL was originally ...