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'
    })
  • 相关阅读:
    LayoutComponent类,用于layout的组件类。 LayoutComponent保存的所有用于布局的数据。
    Button控件常用api
    基础容器的常用接口
    tolua.cast的实用方法
    cocos2dx+lua注册事件函数详解
    我所理解cocos2d-x 3.6 lua --使用Cocos Studio
    quick-cocos2d-x学习笔记—定时器
    quick cocos 的scheduler 定时器
    (1)制定开发计划
    (11)UI布局和分辨率适配
  • 原文地址:https://www.cnblogs.com/jiangyunfeng/p/13395005.html
Copyright © 2011-2022 走看看