jq封装方法步骤
例子如下:
(function($) {var compiled = {};$.fn.handlebars = function(template, data) {if (template instanceof jQuery) {template = $(template).html();}compiled[template] = Handlebars.compile(template);this.html(compiled[template](data));}; })(jQuery); $('#content').handlebars($('#template'), { name: "Alan" });
(function($) {var compiled = {};$.fn.handlebars = function(template, data) {if (template instanceof jQuery) {template = $(template).html();}compiled[template] = Handlebars.compile(template);this.html(compiled[template](data));}; })(jQuery); $('#content').handlebars($('#template'), { name: "Alan" });
轉載于:https://www.cnblogs.com/chenyangsuaige/p/6129830.html
總結
- 上一篇: Python流程控制语句
- 下一篇: phpexcel用法(转)