---
title: "nashron  Arttemplate"
author: "lan13217"
date: "2015-12-05T14:35:20Z"
tags: []
categories: ["非技术"]
slug: "nashron-arttemplate"
draft: false
lastmod: "2015-12-05T14:35:20Z"
id: 2262022
url: "https://snowelf.iteye.com/blog/2262022"
---

```java

load("http://aui.github.io/artTemplate/dist/template.js");
var source = "{{if isAdmin}}<h1>{{title}}</h1><ul>{{each list as value i}}<li>索引 {{i + 1}} ：{{value}}</li>{{/each}}</ul>{{/if}}";
var data = {title: '基本例子',isAdmin: true,list: ['文艺', '博客', '摄影', '电影', '民谣', '旅行', '吉他']};
var render = template.compile(source);
var html = render(data);


```