配置好以后,链接将会变成 http://url/childFolder/xxx 的形式

1.修改 router/index.js文件 增加mode:’history’,base:’childFolder’
export default new Router({
mode: 'history',
base:'childFolder',
routes: [...]
2.后端也要配置下,这里以nginx为例
找到:location / {...}
另起一行写入:
location /childFolder {
try_files $uri /childFolder/index.html;
}
附上完整的nginx配置
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root /usr/local/nginx/html;
location / {
index index.html index.htm;
}
location /childFolder {
try_files $uri /childFolder/index.html;
}
}

文章评论 暂无评论
暂无评论