vue的生命周期


vue實例生命周期
支持vue實例的生命周期如下:
beforeCreate
created
beforeMount
mounted

beforeUpdate
updated
activated


頁面生命周期
不論是app還是小程序,生命周期是非常重要的知識點
onLoad 監聽頁面加載
onShow 監聽頁面顯示
onReady 監聽頁面初次渲染完成
onHide 監聽頁面隱藏
onUnload 監聽頁面卸載

onPullDownRefresh 監聽用戶下拉動作
onReachBottom 頁面上拉觸底事件的處理函數
onShareAppMessage 用戶點擊右上角分享
onPageScroll 監聽頁面滾動
onTabItemTap 當前是tab頁時
file

file

setTimeout(function(){

},3000);

file

file

file

file

file

file
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>

file

<template>
 <scroll-view class="menus">
  <view v-for="(menu, index) in menus" :class="[index == currentIndex ? 'menuActive' : ' ' ]"> {{ menu }} </view>
 </scroll-view>
</template>

file


若本號內容有做得不到位的地方(比如:涉及版權或其他問題),請及時聯系我們進行整改即可,會在第一時間進行處理。


請點贊!因為你們的贊同/鼓勵是我寫作的最大動力!

歡迎關注達叔小生的簡書!

這是一個有質量,有態度的博客

博客


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM