Vue-Router去除路由的#号

Vue-Router去除路由的#号_第1张图片

Vue-Router去除路由的#号

开启HTML5 History 模式
src => router => index.js

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({
     
	// History 模式
    mode: 'history',
    routes
});

export default router;

欢迎关注微信公众号"程序员小辉"

微信图片20190813101011.jpg

你可能感兴趣的:(vue,vue)