第一步:路由文件的配置(对你所需要的vue文件进行保存缓存标志的添加)
import Vue from 'vue'import Router from 'vue-router'import HelloWorld from '@/components/HelloWorld'import Message from '@/components/Message'import Search from '@/components/Search'import Home from '@/components/bottomBar/Home'import Person from '@/components/bottomBar/Person'import Release from '@/components/bottomBar/Release'import Collection from '@/components/bottomBar/Collection'Vue.use(Router);const routes =[ { path: '/', name: 'HelloWorld', component: HelloWorld, children: [ { path:'home', component:Home, meta: { title: 'home', keepAlive: true } }, { path:'person', component:Person }, { path:'release', component:Release }, { path:'collection', component:Collection } ] }, { path:"/message", component:Message }, { path:"/search", component:Search } ];const router = new Router({ routes,});export default router
第二步:router-view的设置
首页 发布 收藏 个人中心
第三步:在你需要保存位置的vue文件里面进行操作
1 2 3 4