1.v-bind (abbreviation:) To use data variables defined in data in component properties, or to use expressions in component properties, you need to specify them with v-bind. Abbreviation: 2. v-on (abbreviated as @) Listening to DOM events click.stop can prevent events from penetrating 3.v-model Two-way data binding 4. v-if, v-else-if, v-else Conditional judgment to determine whether a certain content is mounted 5.v-show Conditional judgment to determine whether a certain content is displayed 6. Ternary Operator 7. Empty tag block 8. v-for: List rendering <template> <view v-bind:class="msg" v-bind:data="1+2"> {{msg}} world!-{{num}} <button v-on:click="show">Click me</button> <input v-model="msg" /> <view v-if="flag">vue</view> <view v-else>H5</view> <view>{{flag ? 'Show':'Hide'}}</view> <block> <text>block empty tag</text> </block> <view v-for="(item, index) in arr">{{index+1}}:{{item}}</view> <view @click="c1"> Parent <view @click.stop="c2">Child</view> </view> </view> </template> <script> export default{ //Initialize data, //data:{}, using object form data will not change, not recommended data(){ return { msg:'hello',//variable arr:['vue','H5','CSS'],//array flag:true,//Boolean value num: 1 } }, onLoad(){ setTimeout(()=>{ this.num++; },2000) }, methods:{ show(){ console.log('clicked'); this.flag=!this.flag; }, c1(){ console.log('I am the parent'); }, c2(){ console.log('I am a child'); } } } </script> SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: MySQL data types full analysis
>>: Docker installation rocketMQ tutorial (most detailed)
The execution relationship between the href jump ...
There are many tools available for backing up MyS...
First check the /etc/group file: [root@localhost ...
Table of contents Preface 1. Rendering 2. Code 3....
Create a Directory cd /usr/local/docker/ mkdir je...
How to set a limit on the number of visits to a c...
Prelude We all know that nginx is an excellent re...
MySQL replace and replace into are both frequentl...
This article example shares the specific code of ...
This article records the installation of MySQL 8....
Open the folder C:\web\mysql-8.0.11 that you just...
There are many tags and elements in the HTML head ...
How to refresh iframe 1. To refresh, you can use j...
Compared with the old life cycle Three hooks are ...
Every time I design a web page or a form, I am tr...