框架默認為history模式,生產環境時需要對應的nginx配置支撐。可手動修改為hash模式,值為'hash'。
~~~
context.$configure.set('routerMode', 'history');
~~~
history模式下,nginx的支撐配置如下:
~~~
location / {
proxy_connect_timeout 900s;
client_max_body_size 100m;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_intercept_errors on;
try_files $uri $uri/ /index.html; //主要是這一行 在出現錯誤時,指向index.html
}
~~~