Newer
Older
XinYang_SanWei+RongYun / src / router / index.js
@张强云笔记本 张强云笔记本 on 17 Dec 2021 707 bytes 融云通话接入
// 引入依赖
import Vue from 'vue'
import VueRouter from 'vue-router'
import autoRouter from "../../static/js/vue-auto";
Vue.use(VueRouter);

let routes = autoRouter({
  // 页面级的.vue存放位置,必传
  rc: require.context("@/views", true, /\.vue$/),
  // '/'的重定向,可选,默认为''
  redirect: "/login",
  // 页面级的.vue存放的文件夹,可选,默认为:views
  rootFile: "views"
});

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

// 404
routes.push({
  path: "*",
  redirect: "/state"
});
export default new VueRouter({
  mode: "history",
  routes
});