因为需要实现类似APP页面切换的动画效果,百度google搜索比较少资料,所以自己写文档,希望对您有用
在router/index.js
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
Router.prototype.goBack = function () {
this.isBack = true
window.history.go(-1)
}
const router = new Router({
routes: [
{
path: '/',
name: 'PageTransition',
component: PageTransition, // 引入页面切换组件
children: [{
path: '',
component: Index // 父路由访问页面,例如,访问www.aaa.com/ 显示的是Index组件
}, {
path: '/pageA',
component: PageA // 子路由组件 例如,访问www.aaa.com/pageA 显示为PageA
}, {
path: '/pageB',
component: PageB // 子路由组件 例如,访