vue去掉hash值#
生活随笔
收集整理的這篇文章主要介紹了
vue去掉hash值#
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
官網地址:https://router.vuejs.org/zh-cn/essentials/history-mode.html
但是僅僅按照官網的做法,還是不行,看了很多人的博客和筆記才解決的。
后臺需要配置很多,前端僅僅需要加上
a)??
mode: "history",
b)
將webpack的配置文件的
index: path.resolve(__dirname, '../dist/index.html'),// Paths assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: './',改為 index: path.resolve(__dirname, '../dist/index.html'),// Paths assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/',這是我的參考網站:https://www.cnblogs.com/xyyt/p/7718867.html?
由于后臺的不熟,看了后臺的代碼中有下面的代碼:
<error-page><error-code>404</error-code><location>/index.html</location> </error-page>如果對你有幫助的話,請點贊
總結
以上是生活随笔為你收集整理的vue去掉hash值#的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在Puppet中用ERB模板来自动配置N
- 下一篇: crontab用法与实例