mm_tpl 2.3.4 → 2.3.5
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 +29 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -104,7 +104,7 @@ Tpl.prototype.set_config = function(config) {
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* 执行函数钩子
|
|
108
108
|
* @param {String} name 名称
|
|
109
109
|
* @param {Object} req 请求参数
|
|
110
110
|
* @param {Object} args 附加参数
|
|
@@ -113,12 +113,27 @@ Tpl.prototype.runFunc = function(name, req, ...args) {
|
|
|
113
113
|
return $.hook.runFunc(name, this.viewBag, req, ...args);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
|
|
116
117
|
/**
|
|
117
|
-
*
|
|
118
|
+
* 初始化之前
|
|
118
119
|
* @param {Object} config 配置参数
|
|
119
120
|
*/
|
|
120
|
-
Tpl.prototype.
|
|
121
|
+
Tpl.prototype.init_before = function(config) {
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 初始化主体
|
|
126
|
+
* @param {Object} config 配置参数
|
|
127
|
+
*/
|
|
128
|
+
Tpl.prototype.init_main = function(config) {
|
|
121
129
|
this.set_config(config);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 初始化之后
|
|
134
|
+
* @param {Object} config 配置参数
|
|
135
|
+
*/
|
|
136
|
+
Tpl.prototype.init_after = function(config) {
|
|
122
137
|
var lt = this.config.change_str;
|
|
123
138
|
for (var i = 0; i < lt.length; i++) {
|
|
124
139
|
var str = lt[i];
|
|
@@ -131,6 +146,16 @@ Tpl.prototype.init = function(config) {
|
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
148
|
|
|
149
|
+
/**
|
|
150
|
+
* 初始化
|
|
151
|
+
* @param {Object} config 配置参数
|
|
152
|
+
*/
|
|
153
|
+
Tpl.prototype.init = function(config) {
|
|
154
|
+
this.init_before(config);
|
|
155
|
+
this.init_main(config);
|
|
156
|
+
this.init_after(config);
|
|
157
|
+
}
|
|
158
|
+
|
|
134
159
|
/**
|
|
135
160
|
* 转译字符
|
|
136
161
|
* @param {String} body 字符串
|
|
@@ -272,7 +297,7 @@ Tpl.prototype.render_sub = function(body, model, options) {
|
|
|
272
297
|
Tpl.prototype.render = function(body, model, options) {
|
|
273
298
|
body = this.change(body);
|
|
274
299
|
body = this.render_sub(body);
|
|
275
|
-
return
|
|
300
|
+
return this.change(body, true);
|
|
276
301
|
};
|
|
277
302
|
|
|
278
303
|
/**
|