Plone技术资料

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1898|回复: 0

Mockup用到的Backbone 简单介绍

[复制链接]
发表于 2019-8-11 10:19:02 | 显示全部楼层 |阅读模式
Mockup应用Backbone.js来做前端js框架。

Backbone’s Templates 语法说明
Backbone has a utility/helper library called underscore.js (underscore是为java-script
提供函数式编程的扩展库,Backbone依存于underscore)and you can use their template solution out of box. You can also use any other template solution that you want like mustache or handlebars. Let’s stick with _.js for simplicity’s sake.
_.js templates have the following syntax,
_.template(templateString, [data], [settings])
where in the templateString you use the place holder
  1. <%= %>
复制代码

and
  1. <%- %>
复制代码

to dynamically insert data. The later allows for HTML escape while the first one doesn’t. Moreover, you can use
  1. <% %>
复制代码

to run any javascript code.

Mockup用到requirejs 的text插件来载入模板(也可以载入其他文本资源,如css,js,html等等),模板文件往往采用xml后缀,此时,这类xml文件模板
遵循上面的语法。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|Plone技术资料 ( 湘ICP备14006519号-1 )

GMT+8, 2019-11-16 04:22 , Processed in 0.043785 second(s), 14 queries , Gzip On.

Powered by Plone! X3.4

© 2001-2019 Plone.org.

快速回复 返回顶部 返回列表