How to use the tmpl/1.0.x/.render function in tmpl

To help you get started, we’ve selected a few tmpl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heeroluo / jraiser / calendar / 1.0.x / index-debug.js View on Github external
render: function(settings) {
		var t  = this, options = t._options;

		// 创建数据模型
		if (t._model) {
			t._model.month(settings.month);
			t._model.year(settings.year);
		} else {
			t._model = new CalendarModel(settings.year, settings.month);
		}

		var data = t._model.build(settings.selectedDates);

		options.wrapper.empty().html(
			tmpl.render(options.template, {
				weekDayNames: options.weekDayNames,
				data: data
			})
		).find('td').click(function(e) {
			e.preventDefault();
			var date = new Date( parseInt( this.getAttribute('data-timestamp') ) );
			/**
			 * 选择月历中的某一天时触发
			 * @event dayselect
			 * @for Calendar
			 * @param {Object} e 事件对象
			 *   @param {Date} e.selectedDate 被选择那一天的日期对象
			 *   @param {Element} e.dayGrid 被点击的日期格子
			 */
			t.trigger('dayselect', {
				selectedDate: date,
github heeroluo / jraiser / paginator / 1.0.x / index-debug.js View on Github external
_init: function(options) {
		var t = this, wrapper = options.wrapper;

		if (!wrapper) { return; }

		// 写入分页条HTML
		wrapper.empty().html( tmpl.render(options.template, {
			currentPage: options.currentPage,
			totalPages: options.totalPages,
			pageNumbers: t._build(),
			nextText: options.nextText,
			prevText: options.prevText,
			ellipsisText: options.ellipsisText
		}) );

		/**
		 * 点击分页条中的链接时触发
		 * @event click
		 * @param {Object} e 事件参数
		 *   @param {Number} e.page 页码
		 * @for Paginator
		 */
		wrapper.find('a').click(function(e) {
github heeroluo / jraiser / waterfall / 1.0.x / index-debug.js View on Github external
_add: function(result) {
		var t = this, col = t._cols.length - 1;

		var html = tmpl.render(t._options.template, result);
		if (!html) { return; }

		var grids = $(html).css('position', 'absolute');
		if (stylePrefix != null) {
			grids.css({
				top: t._cols[col],
				left: (t._gridWidth + t._colSpacing) * col
			});
		}

		html = null;

		t._wrapper.append(grids);

		/**
		 * 格子添加到页面上时触发(此时格子中的图片可能没加载完)
github heeroluo / jraiser / waterfall / 1.1.x / index-debug.js View on Github external
_add: function(result) {
		var t = this, col = t._cols.length - 1;

		var html = tmpl.render(t._options.template, result);
		if (!html) { return; }

		var grids = $(html).css('position', 'absolute');
		if (stylePrefix != null) {
			grids.css({
				top: t._cols[col],
				left: (t._gridWidth + t._colSpacing) * col
			});
		}

		html = null;

		t._wrapper.append(grids);

		/**
		 * 格子添加到页面上时触发(此时格子中的图片可能没加载完)

tmpl

JavaScript micro templates.

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis