在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ vue中在keep-alive中exclude設(shè)置了某個(gè)組件,這個(gè)組件中的子組件

vue中在keep-alive中exclude設(shè)置了某個(gè)組件,這個(gè)組件中的子組件不執(zhí)行activated?

app.vue
  <div id="app">
    <keep-alive exclude="Detail">
      <router-view/>
    </keep-alive>
  </div>
Detail.vue中的子組件Comm.vue
  activated () {
    window.addEventListener('scroll', this.handleScroll)
  },
  deactivated () {
    window.removeEventListener('scroll', this.handleScroll)
  }

vue中在keep-alive中exclude設(shè)置了某個(gè)組件,這個(gè)組件中的子組件不執(zhí)行activated函數(shù)?
這段代碼該如何修改?

回答
編輯回答
不舍棄

activated 和 deactivated 將會(huì)在 <keep-alive> 樹(shù)內(nèi)的所有嵌套組件中觸發(fā)。將組件排除在外并不會(huì)觸發(fā)

2017年3月8日 16:12
編輯回答
別傷我

exclude 是不緩存吧,那不是用 created 或者 mounted 就行了。 activated 是不是給緩存過(guò)的組件用的

2017年2月4日 07:19