0.4.0 • Published 2 years ago

@wxml/parser v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@wxml/parser

npm version cnpm version CI Status GitHub license PRs Welcome Twitter Follow Author

A fast and tolerant wxml parser

Installation

## npm
$ npm install @wxml/parser --save-dev
## yarn
$ yarn add @wxml/parser --dev
## cnpm (for china user)
$ cnpm install @wxml/parser --save-dev

Basic Usage

const { parse } = require("@wxml/parser");
const AST = parse(`
  <view class="search-contianer">
    <view class="search" style="height:{{navHeight}}px;padding-top:{{navTop}}px">
      <view class="search-title" src="../../images/actLogo/ytlogo.png">
        {{mallName}}
      </view>
      <input
        placeholder-class="search-placeholder"
        type="text"
        placeholder="please enter keyword for search"
        disabled
        value="{{name}}"
        bindinput="bindinput"
        bindtap="goSearch">
      </input>
    </view>
  </view>
`);
console.log("AST structure: ", AST);

Try Play Online

Open RunKit , and then happy coding !