最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
arttemplate的jQuery帮助方法
时间:2022-06-25 17:26:07 编辑:袖梨 来源:一聚教程网
需支持es5,兼容可以使用es5-shim
/**
* 封装模板使用方法
* @param {string} tplName 模板名
* @param {[type]} data 传入模板的数据
* @param {[type]} method dom操作方法,默认使用html()方法
* @return {[type]} 容器jQuery对象
*/
$.fn.tpl = function (tplName, data, method) {
data = data || {};
method = method || 'html';
return this[method](template(tplName, data));
};
['append', 'prepend', 'after', 'before'].map(function (method) {
(function (method) {
$.fn[method + 'Tpl'] = function (tplName, data) {
return this.tpl(tplName, data, method);
}
})(method);
});
相关文章
- 空洞骑士丝之歌存档怎么保存 手动备份与云存档方法介绍 09-10
- 原神挪德卡莱兑换码是什么 挪德卡莱限时最新兑换码大全 09-10
- 空洞骑士丝之歌XGP与Steam存档互通吗 双平台存档转换方法介绍 09-10
- 空洞骑士丝之歌MOD怎么安装 MOD安装步骤指南 09-10
- 禁闭求生2怎么做泥土弹 泥土弹制作方法 09-10
- 禁闭求生2碎石弹药怎么做 碎石弹药制作攻略 09-10