参考若依文档:
前端手册 | RuoYi
第一步:1、修改vue.config.js中的publicPath属性
原先的属性:
- publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
复制代码
第二步:修改router/index.js,添加一行base属性
原先的样式计划:
- export default new Router({
- mode: 'history', // 去掉url中的#
- scrollBehavior: () => ({ y: 0 }),
- routes: constantRoutes
- })
复制代码
现在添加的样式计划
这句话加了的意思是让原先的访问路径变成admin
第三步:修改layout/components/Navbar.vue中的location.href
原先是location.href="/index"
第四步修改:
修改utils/request.js中的location.href
原先是/index现在改成
- location.href = '/admin/index';
复制代码
之后修改nginx设置,就能够实现域名访问了
- location /admin {
- alias /home/ruoyi/projects/ruoyi-ui;
- try_files $uri $uri/ /admin/index.html;
- index index.html index.htm;
- }
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |