配置好以后,链接将会变成 http://url/childFolder/xxx 的形式
1.修改 router/index.js文件 增加mode:’history’,base:’childFolder’
1 2 3 4 |
export default new Router({ mode: 'history', base:'childFolder', routes: [...] |
2.后端也要配置下,这里以nginx为例
1 |
找到:location / {...} |
另起一行写入:
1 2 3 |
location /childFolder { try_files $uri /childFolder/index.html; } |
附上完整的nginx配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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; } } |
文章评论 暂无评论
暂无评论