mm_tpl 2.1.7 → 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.
Files changed (3) hide show
  1. package/index.js +4 -7
  2. package/package.json +1 -1
  3. 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, content, ...args) {
144
- if (!content) {
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,7 +239,7 @@ 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.config.defualt_dir + this.config.current_theme);
242
+ f = file.fullname(this.config.defualt_dir + this.current_theme);
246
243
  if (!f.hasFile()) {
247
244
  f = file.fullname(this.config.defualt_dir + this.config.defualt_theme);
248
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_tpl",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "这是超级美眉模板帮助类模块,用于MVC模式下的视图渲染",
5
5
  "main": "index.js",
6
6
  "scripts": {
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