router/index.js
import 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)
慕运维8079593
相关分类