An open API service indexing awesome lists of open source software.

https://github.com/leejim/wxml-parser

微信小程序WXML Parser
https://github.com/leejim/wxml-parser

miniprogram parser wxml

Last synced: 8 months ago
JSON representation

微信小程序WXML Parser

Awesome Lists containing this project

README

          





npm
npm
NPM

## wxml-parser

微信小程序 WXML Parser

## 安装

```bash
npm install -D @leejim/wxml-parser
```

## 使用

```js
var WXMLParser = require('@leejim/wxml-parser');
var parser = new WXMLParser({
onopentag(tagname, attrs, isSelfClosing) {},

onclosetag(tagname) {},

ontext(text) {},

oncomment(cmt) {},

ontemplate(tmp) {}
});
parser.write('test');
```

## 参数

### onopentag

参数名|数据类型|描述
--|--|--
tagname | `string` | 标签名
attrs | `Array; interface AttrEntity { key: string; value: string } ` | 单值时只返回 `key`;否则返回 `key`` 和 `value`
isSelfClosing | `boolean` | 是否自闭合标签