VUE第一天

v-clock  閃動問題 
v-test 會替換標籤的內容  --------- {{}}  不替換
v-html 簡析標籤
v-bind: 綁定屬性指令 屬性值就當成了變量 簡寫 : 可以寫合法的表達式 單向綁定
v-model  雙向綁定 實現同步到VM  注意 :只能運用到表單中

v-on: v-on:click="方法" -- 簡寫 @  methods:{
                            方法:function(){
                            }
                           }
                            
()=>{this.}  內部的this和外部的this 一致 


v-for 循環 數組  對象數組  對象  (迭代數字 count in 10 從1開始)    v-for="(item, index) in items"
      key  只能用string/number,用v-bind     :key="index" 
      
      
v-if  每次刪除創建dom
v-show  每次display:none


事件修飾符
@click.stop  阻止父元素事件觸發 阻止冒泡
@click.prevent 阻止默認行爲
@click.capture  捕獲觸發
@click.self  只有點擊當前元素觸發
@click.once  只觸發一次

綁定class 4種  3元模式
:class="['aaa','bbb']"  aaa 是style
:class="['aaa',{'bbb':data}]" 
:class="{aaa:true}" 

綁定style   :style="{ 'color' : item.type == navIndexChild ? '#3E84E9' : '#333333' }"
:style="{color:'red'}" 
:style="data" 
:style="[data1,data2]" 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章