解决vue脚手架项目打包后路由视图不显示的问题
作者:SherrySherryBell 时间:2024-04-27 16:06:31
脚手架vue-cli 搭建的项目,build后放于服务器上,发现其他资源全部变成静态加载成功,但路由视图为空,最初以为是webpack打包的问题,找了好久发现是路由配置问题。
解决办法如下:
Vue.use(VueRouter)
const router = new VueRouter({
mode: 'history',
base: '/system/', //添加根目录
scrollBehavior: () => ({ y: 0 }),
routes
})
比如我是将打包后的dist和index.html放在tomcat上的system下,router 的根目录就是system。
方法很简单,但是找到问题并解决的过程。。。很虐很享受啊
来源:https://blog.csdn.net/sinat_35515778/article/details/73650221
标签:vue,脚手架,路由,视图
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Go语言CSP并发模型实现MPG
2024-05-22 17:46:48
![](https://img.aspxhome.com/file/2023/2/125092_0s.jpg)
Python编程基础之输入与输出
2021-03-03 10:06:07
![](https://img.aspxhome.com/file/2023/3/68883_0s.png)
Python Pandas对缺失值的处理方法
2021-03-18 19:38:55
关于windows下Tensorflow和pytorch安装教程
2023-06-09 07:35:54
![](https://img.aspxhome.com/file/2023/5/70695_0s.png)
JS版的date函数(和PHP的date函数一样)
2023-11-15 02:02:11
用javascript代替marquee的滚动字幕效果代码
2024-05-22 10:36:09
基于Python制作个抢红包的工具
2021-12-03 07:53:01
![](https://img.aspxhome.com/file/2023/1/124241_0s.png)
Python代码库之Tuple如何append添加元素问题
2021-10-02 07:13:34
python2.7实现FTP文件下载功能
2021-10-09 19:04:37
PyCharm中关于安装第三方包的三个建议
2022-03-25 20:08:41
![](https://img.aspxhome.com/file/2023/7/70897_0s.png)
plsql和tsql常用函数比对
2009-09-13 17:50:00
python asyncio 协程库的使用
2022-09-13 13:28:16
Python 串口通信的实现
2022-05-25 21:08:54
![](https://img.aspxhome.com/file/2023/5/127755_0s.png)
SQL 中having 和where的区别分析
2024-01-17 17:23:24
Python可视化神器pyecharts绘制漏斗图
2023-01-09 08:40:09
![](https://img.aspxhome.com/file/2023/2/100962_0s.png)
Vue-Element-Admin前端接入SSO的方法步骤
2023-07-02 16:57:19
Python中PyAutoGUI帮助文档(推荐!)
2022-12-18 20:50:16
Mysql权限管理grant命令使笔记
2024-01-18 02:08:28
Mysql常见bug及解决方案超详细讲解
2024-01-15 17:20:56
![](https://img.aspxhome.com/file/2023/7/128017_0s.png)
python中统计相同字符的个数方法实例
2021-04-21 00:28:58