vue 切换路由后, 保存原页面 输入框 内容
在路由中对需要缓存的路由添加
const router = new VueRouter({
routes: [
{ path: '/', redirect: '/home' },
{ path: '/home', component: Home, keepAlive: true },
{ path: '/CInsure', component: CInsure },
]
})
export default router
给路由展示出口添加
<keep-alive>
<router-view ></router-view>
</keep-alive>