Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanlong/wxml-parser
A JavaScript WXML parser
https://github.com/seanlong/wxml-parser
Last synced: 3 months ago
JSON representation
A JavaScript WXML parser
- Host: GitHub
- URL: https://github.com/seanlong/wxml-parser
- Owner: seanlong
- License: other
- Created: 2016-10-27T03:07:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-28T02:18:26.000Z (about 8 years ago)
- Last Synced: 2024-10-01T12:10:15.265Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 47
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-wechat-app - wxml-parser - JavaScript WXML parser (工具)
- awesome-wechat-weapp - wxml-parser - JavaScript WXML parser (工具)
- awesome-wechat-weapp - wxml-parser - JavaScript WXML parser (工具)
README
wxml-parser
=======[![Build Status](https://travis-ci.org/seanlong/wxml-parser.svg?branch=master)](https://travis-ci.org/seanlong/wxml-parser)
## What
这是一个微信小程序[WXML](http://mp.weixin.qq.com/debug/wxadoc/dev/framework/view/wxml/)文件的JavaScript parser实现。输出微信官方提供的native可执行文件类似的数据结构。
该数据可以被后续微信小程序的Virtual DOM generator生成真实DOM。目前版本支持除了模板和模板引用外的基本语法。
## Run
```
var parser = require('wxml-parser);
console.log(JSON.stringify(parser(' {{ message }} ', {message: 'Hello MINA!'}), null, 2));
```
output:
```
{
"tag": "wx-body",
"attr": {},
"children": [{
"tag": "wx-view",
"attr": {},
"children": ["Hello MINA!"]
}]
}
```
## License[MIT](LICENSE.txt)