如果编译打包后的资源放在域名路径下,
location / {
try_files $uri /index.html;
}
这样可以访问到路由
但是如果 放到 域名/文件夹名 的路径下
路由就不可以使用了,nginx要怎么配置呢
如果编译打包后的资源放在域名路径下,
location / {
try_files $uri /index.html;
}
这样可以访问到路由
但是如果 放到 域名/文件夹名 的路径下
路由就不可以使用了,nginx要怎么配置呢
路由前缀抽取出来就可以了
{
path: `${urlprefix}/ctrldeskset`,
name: 'ctrldeskset',
getComponent(nextState, cb) {
require.ensure([], require => {
app.unmodel('ctrldeskset');
app.model(require('./models/ctrldeskset'));
cb(null, require('./routes/ctrldeskset'));
});
},
},
有个比较笨的办法 route的根目录path=文件夹名 再定义export一个commonPath=文件夹名,后面所有的路由都import路径 这样换目录的时候 只要改两个地方就好了 但是这种不是治本的方法