import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/about',
name: 'About',
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
}
]
const router = new VueRouter({
/*
mode:路由模式
型別: string
默認值: "hash" (瀏覽器環境) | "abstract" (Node.js 環境)
可選值: "hash" | "history" | "abstract"
配置路由模式:
hash: 使用 URL hash 值來作路由,支持所有瀏覽器,包括不支持 HTML5 History Api 的瀏覽器,顯示為:http://localhost:8080/#/about
history: 依賴 HTML5 History API 和服務器配置,查看 HTML5 History 模式,顯示為:http://localhost:8080/about
abstract: 支持所有 JavaScript 運行環境,如 Node.js 服務器端,如果發現沒有瀏覽器的 API,路由會自動強制進入這個模式, http://localhost:8080/
*/
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/163506.html
標籤:python
