mini-html-parser3

0.3.4 • Public • Published

mini-html-parser3

背景

fork项目阿里项目mini-html-parser,重新编译把依赖打包到一起。

版本

本版本0.3.x 对应官网0.3.0

安装

$ npm install mini-html-parser3 --save

使用

// page.js
const html = `<div>
<span>test</span>
<div>
    <span>table test</span>
    <table>
        <thead>
            <tr>
                <th>title</th>
                <th>title</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td colspan="2">yy</td>
                <td>xx</td>
                <td>xx</td>
                <td>xx</td>
            </tr>
        </tbody>
    </table>
</div>
</div>`
import parse from 'mini-html-parser3';

Page({
  data: {
    nodes: [],
  },
  onLoad() {
    parse(html, (err, nodes) => {
      if (!err) {
        this.setData({
          nodes,
        });
      }
    })
  },
})
<!-- page.axml -->
<rich-text nodes="{{nodes}}" />

运行测试

$ npm run build
$ npm test

Package Sidebar

Install

npm i mini-html-parser3

Weekly Downloads

1

Version

0.3.4

License

none

Unpacked Size

35.3 kB

Total Files

3

Last publish

Collaborators

  • peacejj