标签:asc compile mpi class jquer lan 封装 方法 var
例子如下:
(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" });
标签:asc compile mpi class jquer lan 封装 方法 var
原文地址:http://www.cnblogs.com/chenyangsuaige/p/6129830.html