2015-12-28 366 views

回答

1

这取决于您是如何编制的模板

,如果你使用的是像

<script id="template1" type="text/template7">....</script> 

薄模板编译并做

var compiledTemplate = Template7.compile(template); 
var data = { 
    foo: 'bar' 
}; 
var html = compiledTemplate(data); 
$$('#element').html(html); 
加载页面,您可以手动编译和加载

如果您正在使用模板页面
例如:home_page.html

<div class="pages navbar-through"> 
<div data-page="home" class="page navbar-through"> 
    .... 
    <div>{{foo}}<div> 
    ... 

那么你就可以自动编译使用页面Framework7

var myApp = new Framework7({ 
    ... 
    precompileTemplates: true, 
    template7Pages: true, 
    template7Data: { 
     'url:pages/home_page.html': {foo: 'bar'} 
    } 
});  

注意 你不能编译您的默认页例如:页index.html但如果你想这样做,将该页面的内容移动到另一个文件,例如main_page.html并使用

mainView = myApp.addView('.view-main', { 
     dynamicNavbar: true // for ios only 
    }); 
mainView.router.loadPage('pages/main_page.html'); 

更多信息阅读Template7 syntax

0

在Chrome中按F12进入开发模式,然后1秒钟以上地址栏前持有刷新按钮。此操作会向您显示Hard Reload option。点击此按钮将清除Chrome缓存。