如何延迟整个应用程序的加载?在加载整个应用程序之前,我想检查访问的用户是否为授权用户。有没有什么事件可以让我进入应用程序加载之前的状态?我目前使用的是Extjs 7.1
发布于 2020-03-11 18:29:07
此问题的最佳解决方案是在用户具有访问权限之前根本不加载应用程序脚本。这需要在后端完成。如果您没有这样的机会,您可以检查用户在launch方法上的权限和授权,并在其中创建条件
...
launch: function () {
if(user.authorized) {
Ext.create('My.Viewport')
} else {
Ext.create('My.PermissionsDenied')
}
}
...发布于 2020-03-11 18:30:53
在app.js文件中,使用launch函数对页面加载执行操作。
Ext.application({
extend: 'application.Application',
name: 'application',
requires: [
],
stores: [
],
defaultToken: 'home',
launch: function () {
var me = this;
// make a request to find out if user is auhtenticated
//in callback set me.setMainView('application.view.main.Main');
}
});https://stackoverflow.com/questions/60633704
复制相似问题