JSPM

wxml-parser

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q54711F
  • License MIT

wxapp WXML(HTML like layout file) parser

Package Exports

  • wxml-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wxml-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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