mm_tpl 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -8
- package/package.json +1 -1
- package/test.js +5 -3
package/index.js
CHANGED
|
@@ -140,17 +140,14 @@ Tpl.prototype.loadFunc = function(m) {
|
|
|
140
140
|
m.render = function(body, model, options) {
|
|
141
141
|
return _this.render(body, model, options);
|
|
142
142
|
}
|
|
143
|
-
m.hook_action = function(name,
|
|
144
|
-
|
|
145
|
-
content = "";
|
|
146
|
-
}
|
|
147
|
-
return $.hook.runAction(name, content, ...args);
|
|
143
|
+
m.hook_action = function(name, ...args) {
|
|
144
|
+
return $.hook.runAction(name, "", m, ...args);
|
|
148
145
|
}
|
|
149
146
|
m.hook_filter = function(name, content, ...args) {
|
|
150
147
|
if (!content) {
|
|
151
148
|
content = "";
|
|
152
149
|
}
|
|
153
|
-
return $.hook.runFilter(name, content, ...args);
|
|
150
|
+
return $.hook.runFilter(name, content, m, ...args);
|
|
154
151
|
}
|
|
155
152
|
return m;
|
|
156
153
|
}
|
|
@@ -242,9 +239,9 @@ Tpl.prototype.view = function(file, model, options) {
|
|
|
242
239
|
if (!f.hasFile()) {
|
|
243
240
|
f = file.fullname(this.dir + this.config.defualt_theme);
|
|
244
241
|
if (!f.hasFile()) {
|
|
245
|
-
f = file.fullname(this.defualt_dir + this.
|
|
242
|
+
f = file.fullname(this.config.defualt_dir + this.current_theme);
|
|
246
243
|
if (!f.hasFile()) {
|
|
247
|
-
f = file.fullname(this.defualt_dir + this.config.defualt_theme);
|
|
244
|
+
f = file.fullname(this.config.defualt_dir + this.config.defualt_theme);
|
|
248
245
|
}
|
|
249
246
|
}
|
|
250
247
|
}
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -47,15 +47,17 @@ async function test() {
|
|
|
47
47
|
tpl.current_theme = "game";
|
|
48
48
|
tpl.dir = "";
|
|
49
49
|
|
|
50
|
-
$.hook.addAction('test', (ret)
|
|
50
|
+
$.hook.addAction('test', function(ret, m) {
|
|
51
|
+
console.log(m);
|
|
51
52
|
return "<div>你好吗?</div>";
|
|
52
53
|
}, 2, "测试动作2");
|
|
53
54
|
|
|
54
|
-
$.hook.addAction('test', (ret)
|
|
55
|
+
$.hook.addAction('test', function(ret) {
|
|
55
56
|
return "<div>你好!</div>";
|
|
56
57
|
}, 1, "测试动作1");
|
|
57
58
|
|
|
58
|
-
$.hook.addFilter('test', (ret)
|
|
59
|
+
$.hook.addFilter('test', function(ret, m) {
|
|
60
|
+
console.log(m);
|
|
59
61
|
return ret.replace("你", "您");
|
|
60
62
|
}, 1, "测试过滤");
|
|
61
63
|
|