mm_tpl 2.2.3 → 2.2.4

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.
@@ -9,6 +9,7 @@
9
9
  <div><div class="bar_user"><div>您好吗?</div><div>你好!</div>
10
10
  <div>用户ID:1</div>
11
11
  <div>当前项目ID:2</div>
12
+ <div>hello world!</div>
12
13
  </div>
13
14
 
14
15
  <div class="bar">导航栏</div>
package/index.js CHANGED
@@ -146,10 +146,10 @@ Tpl.prototype.render_before = function(body, model, options) {
146
146
  Tpl.prototype.loadFunc = function(m) {
147
147
  var _this = this;
148
148
  m.view = function(file, model, options) {
149
- return _this.view(file, model, options);
149
+ return _this.view(file, Object.assign({}, m, model), options);
150
150
  }
151
151
  m.render = function(body, model, options) {
152
- return _this.render(body, model, options);
152
+ return _this.render(body, Object.assign({}, m, model), options);
153
153
  }
154
154
  m.hook_action = function(name, ...args) {
155
155
  return $.hook.runAction(name, m, ...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_tpl",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "这是超级美眉模板帮助类模块,用于MVC模式下的视图渲染",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,6 +2,7 @@
2
2
  ${@hook_filter('test', hook_action('test', '好的'), '真的')}
3
3
  <div>用户ID:${viewBag.user_id}</div>
4
4
  <div>当前项目ID:${viewBag.project_id}</div>
5
+ <div>${message}</div>
5
6
  </div>
6
7
 
7
8
  <div class="bar">导航栏</div>
package/test.js CHANGED
@@ -84,7 +84,8 @@ async function test() {
84
84
 
85
85
  // 渲染视图(并缓存)
86
86
  var body = tpl.view("./test", {
87
- arr: [123, 234]
87
+ arr: [123, 234],
88
+ message: "hello world!"
88
89
  }, {
89
90
  // 是否读取缓存文件, 如果为false, 但有cache_filename, 表示只保存缓存,但不读取
90
91
  cache: false,