Juicer template engine usage records. MD

Source: Internet
Author: User

Juicer is an efficient, lightweight front-end (Javascript) template engine that uses juicer to enable your code to decouple data and view models (MVC).

Comments:{# 注释内容}
Auxiliary loops:{@each i in range(m, n)}
Judge:{@if} ... {@else if} ... {@else} ... {@/if}
Escape/Avoid escaping: prevents $${变量} content from being escaped

Output variables:${变量}

${name}${name|function}${name|function, arg1, arg2}

Loop traversal:{@each} ... {@/each}

{@each list as item, index}    ${item.prop}    ${index} //当前索引{@/each}

Template definition and use:

// 引入juicer<script type="text/javascript" src="juicer-min.js></script>// 定义模板<script type="text/juicer"id="tplId">    Hi, ${name}</script>// 渲染模板var data = { name: ‘vipin‘ };juicer(‘tplId‘, data);

Official address: Https://github.com/PaulGuo/Juicer

Juicer template engine usage records. MD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.