Skip to content
A JavaScript WXML parser
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE.txt
README.md
dom_parser.js
gulpfile.js
index.js
package.json

README.md

wxml-parser

Build Status

What

这是一个微信小程序WXML文件的JavaScript parser实现。输出微信官方提供的native可执行文件类似的数据结构。
该数据可以被后续微信小程序的Virtual DOM generator生成真实DOM。

目前版本支持除了模板和模板引用外的基本语法。

Run

var parser = require('wxml-parser);
console.log(JSON.stringify(parser('<view> {{ message }} </view>', {message: 'Hello MINA!'}), null, 2));

output:

{
  "tag": "wx-body",
  "attr": {},
  "children": [{
    "tag": "wx-view",
    "attr": {},
    "children": ["Hello MINA!"]
  }]
}

License

MIT

You can’t perform that action at this time.