vue實例生命周期
支持vue實例的生命周期如下:
beforeCreate
created
beforeMount
mounted
beforeUpdate
updated
activated
頁面生命周期
不論是app還是小程序,生命周期是非常重要的知識點
onLoad 監聽頁面加載
onShow 監聽頁面顯示
onReady 監聽頁面初次渲染完成
onHide 監聽頁面隱藏
onUnload 監聽頁面卸載
onPullDownRefresh 監聽用戶下拉動作
onReachBottom 頁面上拉觸底事件的處理函數
onShareAppMessage 用戶點擊右上角分享
onPageScroll 監聽頁面滾動
onTabItemTap 當前是tab頁時
setTimeout(function(){
},3000);
class
<view :class="{ active: isActive }">111</view>
<view class="static" v-bind:class="{active: isActive, 'text-danger': hasError}">222</view>
<view class="static" :class="[activeClass, errorClass]">333</view>
<view class="static" v-bind:class="[isActive ? activeClass : ' ', errorClass]">444</view>
<view class="static" v-bind:class="[{active: isActive}, errorClass]">555</view>
style:
<view v-bind:style="{color : activeColor, fontSize: fontSize + 'px' }">666</view>
<view v-bind:style="[{color: activeColor, fontSize: fontSize+'px'}]">777</view>
<template>
<scroll-view class="menus">
<view v-for="(menu, index) in menus" :class="[index == currentIndex ? 'menuActive' : ' ' ]"> {{ menu }} </view>
</scroll-view>
</template>
若本號內容有做得不到位的地方(比如:涉及版權或其他問題),請及時聯系我們進行整改即可,會在第一時間進行處理。
請點贊!因為你們的贊同/鼓勵是我寫作的最大動力!
歡迎關注達叔小生的簡書!
這是一個有質量,有態度的博客