码迷,mamicode.com
首页 > 其他好文 > 详细

VueCli路由配置

时间:2020-07-29 10:29:00      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:self   red   ons   close   type   log   load   lse   win   

import Vue from vue
import Router from vue-router

Router.prototype.go = function(t) {
  this.isBack = true
  console.log(go=== + this.history.current.name)
  let currentName = this.history.current.name
  if (!t) window.history.go(-1)
  else window.history.go(t)
  var self = this
  setTimeout(function() {
    if (currentName === self.history.current.name) {
      try {
        uexWindow.close(-1)
      } catch (e) {}
    }
  }, 100)
}
Router.prototype.back = function(t) {
  this.isBack = true
  let currentName = this.history.current.name
  if (t) window.history.back()
  else window.history.back()
  var self = this
  setTimeout(function() {
    if (currentName === self.history.current.name) {
      try {
        uexWindow.close(-1)
      } catch (e) {}
    }
  }, 100)
}
// 路由懒加载
const index = () => import(@/page/index/index).then(m => m.default)
const home = () => import(@/page/index/home/index).then(m => m.default)
const b = () => import(@/page/index/b/index).then(m => m.default)
const jssdk = () => import(@/page/jssdk/jssdk).then(m => m.default)
const list = () => import(@/page/list/index).then(m => m.default)
const mylist = () => import(@/page/mylist/index).then(m => m.default)
const upload = () => import(@/page/upload/index).then(m => m.default)
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: ‘‘,
      redirect: /index/home,
      name: index,
      component: index,
      children: [
        {
          path: /index/home,
          name: home,
          component: home
        },
        {
          path: /index/b,
          name: b,
          component: b
        }
      ]
    },
    {
      path: /jssdk,
      name: jssdk,
      component: jssdk
    },
    {
      path: /list,
      name: list,
      component: list
    },

    {
      path: /mylist,
      name: mylist,
      component: mylist
    },
    {
      path: /upload,
      name: upload,
      component: upload
    }
  ],
   mode:history
})

 

VueCli路由配置

标签:self   red   ons   close   type   log   load   lse   win   

原文地址:https://www.cnblogs.com/jiangyunfeng/p/13395005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!