Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ektx/generatetemhtml
模板生成器
https://github.com/ektx/generatetemhtml
Last synced: about 1 month ago
JSON representation
模板生成器
- Host: GitHub
- URL: https://github.com/ektx/generatetemhtml
- Owner: ektx
- Created: 2016-01-20T07:12:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-20T07:37:42.000Z (almost 9 years ago)
- Last Synced: 2024-04-14T07:20:01.714Z (9 months ago)
- Language: JavaScript
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# GenerateTemHTML
HTML模板生成器## 参数说明
```js
// @temlpate: 模板名称,最好是id,样式最好是唯一
// @data: JSON数组数据
var html = generateTemHTML(temlpate, data);
```## 使用方式:
将要使用的HTML指定一个id,对内容数据进行[[[数据可以用内容]]]来处理
```html...
...
-
[[[姓名]]]
[[[年龄]]]
var data = [
{'姓名': 'zwl', '年龄': 27},
{'姓名': '张飞', '年龄': 57}
];
// 引入模板
var html = generateTemHTML('#demo-template', data)
// 生成代码
$('#demo-template').html(html)
```