1.vue的mode 模式主要有兩種,默認是hash模式,另一種是history模式,hash模式與history形式上的不同,hash會導致url上多了#/,而history沒有。
2.vue hash模式帶#/對開發造成的影響主要有以下四種情況。
(1)微信三方登錄回調地址,有#號時,接收不到code參數
(2)微信H5支付的回調地址,不允許有#
(3)App分享,處理特殊字符時,可能會對#進行編譯
(4)有點影響美觀
3.history 模式的相關設置
const router = new VueRouter({ mode:'history',//history設置 // base:'/', routes });
//vue.config.js publicPath: "/",//history模式下publicPath: "/",hash模式下publicPath: "./"
4.nginx配置history模式支持