router/index.jsimport Vue from 'vue'import VueRouter from 'vue-router'Vue.use(VueRouter)const route = new VueRouter({ routes:[
{ path:'/song/list',component: require('../views/song_list')
},{ path:'/singer/list',component: require('../views/singer_list')
},{ path:'/custom/list',component: require('../views/custom_list')
},{ path:'*',redirect:'/song/list'
}
]
})export default route;頭部導航this.$router.push({path:this.headTabs[index].path})子頁面每次都會重載(打印'song_list加載了')created (){ console.log('song_list加載了') this.reqSongList();
var mySwiper = new Swiper('.swiper-container', { direction: 'horizontal',
loop: true, autoplay : 3000, pagination: '.swiper-pagination'
});
}看別人的例子都是加載一次后,再次切換時都是直接顯示了(沒有加動態參數),沒有重載(觸發created)
vue 2.0 router每次切換頁面都會重載
慕碼人8056858
2018-10-12 14:15:07