官網(wǎng)文檔:https://router.vuejs.org/zh/guide/essentials/history-mode.html
由于公司內(nèi)容原因沒有https的測試域名
所以在正式接口后加了個(gè)绊含、/t/ eg:https:xxxx.com 測試接口域名====>https:xxxx.com/t
1.在路由文件 router /index.js里配置路由模式
image.png
2.打包項(xiàng)目后發(fā)現(xiàn)報(bào)錯(cuò)
Uncaught SyntaxError: Unexpected token '<'
image.png
現(xiàn)象:這是由于 打包的引入路徑不能正常的點(diǎn)開罪治,于是改成了正確的js路徑,需要修改打包路徑----修改文件 config/index.js打包配置
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',//靜態(tài)資源路徑 ----》修改成相對(duì)路徑
3.需要后臺(tái)配合
vue使用history匙监,需要后臺(tái)幫忙配置頁面路徑
參考文章
https://www.jb51.net/article/162268.htm
https://segmentfault.com/a/1190000015947783
https://www.jb51.net/article/132456.htm
標(biāo)題名稱
image.png