Browse Source

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

无木 6 years ago
parent
commit
842cfbedeb
1 changed files with 7 additions and 1 deletions
  1. 7 1
      public/assets/js/require-backend.js

+ 7 - 1
public/assets/js/require-backend.js

@@ -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);
                         // 这里可捕获模块加载的错误