Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMU 模板引擎 能支持 预编译吗? #187

Open
qqqzhch opened this issue Dec 30, 2013 · 3 comments
Open

GMU 模板引擎 能支持 预编译吗? #187

qqqzhch opened this issue Dec 30, 2013 · 3 comments

Comments

@qqqzhch
Copy link

qqqzhch commented Dec 30, 2013

GMU 模板引擎 能支持 预编译吗?

@qqqzhch
Copy link
Author

qqqzhch commented Dec 30, 2013

想谷歌的
Closure 库里面的模板一样 可以编译为js函数 这样
1 可以跨域获取
2 可以加速展示 降低 cpu 和内存

@qqqzhch
Copy link
Author

qqqzhch commented Dec 30, 2013

解析模版tpl。当data未传入时返回编译结果函数;当某个template需要多次解析时,建议保存编译结果函数,然后调用此函数来得到结果

上哪去保存编辑结果函数?????官方的demo和api写的太简单了!

@2betop
Copy link
Contributor

2betop commented Dec 30, 2013

支持,不传入data,第二个参数,返回一个给你编译后的function,用法如下:

var render = $.parseTpl('<p><%=name%></p>');

console.log( render({name: 'Abc'}) );    // => <p>Abc</p>
console.log( render({name: 'Efg'}) );    // => <p>Efg</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants