-
父子傳值
查看全部 -
父傳子? 通過? 屬性的方式傳遞? 如:?
????:content="item"??
????:index="index"
子組件通過 propos:['content','index'], 接收父組件的傳值
查看全部 -
掛載點<div = "app"></div>? 里面包含的是模板? ? ? 實例可以看做一個組件 Vue({}) 是一個大的實例 或組件
查看全部 -
<div?id="root">? ????<input?v-model="inputValue"?/> ????<button?v-on:click="handleSubmit">提交</button> ????<ul> ????????<li?v-for="(item,index)?of?list"?:key="index">?{{item}}</li> ????</ul> </div> <script> ????new?Vue({ ????????el:?"#root", ????????data:?{ ????????????inputValue:?''hello", ????????????list:?[] ????????}, ????????methods:?{ ????????????handleSubmit:?function()?{ ????????????????this.list.push(this.inputValue) ????????????????this.inputValue?=?"" ????????????} ????????} ????}) </script>
查看全部 -
<li v-for="(item,index) of list"? :key =“index”>{{item}}</li>? ? 加key值 提升渲染效率
查看全部 -
計算屬性
查看全部 -
?
插值表達式:v-text = “”
帶樣式: v-html= “”
點擊事件:?v-on:click =“事件名”? 或者? @click =“事件名”
屬性綁定: v-bind:屬性名= “屬性值”? 或者 :屬性名= “屬性值”? ? ?
雙向?qū)傩越壎ǎ? v-model = “變量名”
查看全部 -
面向數(shù)據(jù)編程?
查看全部 -
掛載點? 模板? 實例
查看全部 -
函數(shù)觸發(fā),在method里執(zhí)行查看全部
-
v-bind指令的簡寫是:
雙向數(shù)據(jù)綁定的指令是v-model
查看全部 -
v-on:可用@符號代替
查看全部 -
偵聽器,偵聽某一個屬性所發(fā)生變化,發(fā)生變化則在偵聽器里所改變屬性
查看全部 -
v-bind
v-mode
查看全部 -
v-text="number" =>
v-html="number"
(模板指令,text不會進行轉(zhuǎn)譯,而html會)
標簽綁定事件
v-on:click="handleclick"=>綁定一個click事件? ?handleclick為函數(shù)
在methods 輸入 handleclick: function(){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?alert(123)
? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ?}
}
可直接改變數(shù)據(jù)
查看全部
舉報