wxml-ast
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

wxml-ast

Introduction

解析 wxml 并进行操纵和渲染

APIs

parse

解析 wxml 并返回 wxml-ast

wxml-ast 可使用 domutils 进行操纵(已内置在此 lib 中)

Parameters:

Name Type Default value Description
chunk string - wxml 字符串
options UserDefinedOptions {} 改变序列化行为
UserDefinedOptions
export interface UserDefinedOptions {
  // https://github.com/fb55/htmlparser2
  parserOptions?: ParserOptions
  // https://github.com/fb55/domhandler
  domHandlerOptions?: DomHandlerOptions
  elementCB?: (element: Element) => void
}

render

根据 wxml-ast 渲染 wxml

Parameters:

Name Type Default value Description
node Node | Node[] - 节点需要被渲染的节点
options DomSerializerOptions {} 改变序列化行为

export * from 'domutils'

domutils 导出的操纵 ast 方法

文档

Package Sidebar

Install

npm i wxml-ast

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

391 kB

Total Files

15

Last publish

Collaborators

  • icebreaker