让我们说我有两条路由/
和/first
,并且都应该路由到不同的vue应用。
我的根切换正常,问题是当您转到/first
时,vue应用程序无法加载任何javascript文件或css文件,因为它们转到了/js
或{{1} },而不是/css
或/first/js
我有两个很简单的位置块:
/first/css
js和css文件通常以 location /first {
alias /home/first/dist;
index index.html index.htm;
}
location / {
alias /home/second/dist;
index index.html index.htm;
}
的形式加载。我之所以这样说是不可行的,是因为nginx在响应中剥离了/js/chunk-vendors.deb8a740.js
,因为如果将导入更改为/first
,应用程序就会加载。