zoukankan      html  css  js  c++  java
  • 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'
    })
  • 相关阅读:
    Django----博客文章数据返回
    Django----admin模块初识
    Django搭建博客文章---模型层
    Js 提交 form 表单
    sql 查询 between and 和 >= <= 比较
    C# 未能加载项目文件
    不一样的 Null
    Js实现table单双行交替色
    C# 判断一个string型的时间格式是否正确
    利用 Label 小小的提升一下用户体验
  • 原文地址:https://www.cnblogs.com/jiangyunfeng/p/13395005.html
Copyright © 2011-2022 走看看