framework7教程

Framework7 模板概述

说明

Template7 是一个轻量级、移动优先的 JavaScript 引擎,它将 Ajax 和动态页面表示为具有指定上下文的 Template7 模板,不需要任何额外的脚本。 Template7 与 Framework7 相关联,作为默认的轻量级模板引擎,在应用程序中运行速度更快。

性能

string 编译成 JS 函数的过程是 template7 中最慢的一段。因此,您不需要多次编译模板,一次就足够了。
//Here initialize the app
var myApp = new Framework7();
// After initializing compile templates on app
var searchTemplate = $('script#search-template').html();
var compiledSearchTemplate = Template7.compile(searchTemplate);
var listTemplate = $('script#list-template').html();
var compiledListTemplate = Template7.compile(listTemplate);
// Execute the compiled templates with required context using onPageInit() method
myApp.onPageInit('search', function (page) {
   // Execute the compiled templates with required content
   var html = compiledSearchTemplate({/*...some data...*/});
   // do stuff with html
});
Template7 是一个轻量级模板引擎,用作没有 Framework7 的独立库。可以使用两种方式安装 Template7 文件-
您可以从 Template7 github 存储库下载。
您可以通过 Bower 使用以下命令安装它-
bower install template7
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4