动态路由
{
path:'/details/:id',
name:'details',
component:Details
}
全局事件解绑
activated() {
window.addEventListener('scroll',this.handScroll)
},
deactivated() {
window.removeEventListener('scroll',this.handScroll)
}
递归组件
组件自身调用自身
<div v-for='(item,index) in list' :key='index' class='item'>
<div class="item-title border-bottom">
<span class="item-icon">
{{item.title}}
</span>
</div>
<div v-if='item.children' class='item-children'>
<Listt :list='item.children'>
</Listt>
</div>
</div>
export default {
name:'Listt',
props:['list']
}
多页面拖动影响
scrollBehavior(to, from, savedPosition){
return {x: 0,y: 0} }
(路由配置)
渐隐渐现组件
<template>
<div>
<transition>
<slot>
</slot>
</transition>
</div>
</template>
<style lang="stylus" scoped>
.v-enter,.v-leave-to
opacity 0
.v-enter-to,.v-leave-active
transition opacity 1s
</style>