JS模块支持空操作重定向到_empty

pull/123/head
无木 2019-05-22 14:08:05 +08:00
parent 16e02f643f
commit 842cfbedeb
1 changed files with 7 additions and 1 deletions

View File

@ -146,7 +146,13 @@ require(['jquery', 'bootstrap'], function ($, undefined) {
//加载相应模块
if (Config.jsname) {
require([Config.jsname], function (Controller) {
Controller[Config.actionname] != undefined && Controller[Config.actionname]();
if (Controller.hasOwnProperty(Config.actionname)) {
Controller[Config.actionname]();
} else {
if (Controller.hasOwnProperty("_empty")) {
Controller._empty();
}
}
}, function (e) {
console.error(e);
// 这里可捕获模块加载的错误