• VueCli路由配置


    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'
    })
  • 相关阅读:
    Redis做为缓存的几个问题
    Python——操作smb文件服务器(上传和下载)
    Python——assert、isinstance的用法
    centos7-修改默认python为3
    mqtt
    如何编译生成 mkfs.ubifs、ubinize 工具
    2020-2笔记
    2020-1笔记
    C语言中getopt()和getopt_long()函数的用法
    buildroot
  • 原文地址:https://www.cnblogs.com/jiangyunfeng/p/13395005.html
Copyright © 2020-2023  润新知