1.引入.js文件
2.挂载点
<div class="app"> <img :src="img1" @click="dom1" :class="{xz:isshow}" /> <p v-if="isshow">{{message}}</p> <input type="button" id="btn1" @click="dom1"> </div> <script> var app = new Vue({ el: '.app', data: { message: 'Hello Vue!', age:"test123", isshow:true, img1:'https://www.baidu.com/img/flexible/logo/pc/result.png' }, methods:{ dom1:function(){ this.isshow=!this.isshow; } } }) </script>
3.指令
v-text
v-html
v-on
v-show
v-if
v-bing
v-for
v-model