convert html to wxml.微信小程序html转wxml.

网友投稿 897 2022-10-10

convert html to wxml.微信小程序html转wxml.

convert html  to wxml.微信小程序html转wxml.

微信小程序,HTML转WXML。

更新:好消息,微信小程序在基础库 1.6.4 添加了 web-view 组件!

usage:

npm install html2wxml --save

引入src里面html2json.js/html2wxml.wxml/htmlparser.js/example.wxss到工程lib目录下;在需要将html转wxml的地方按下添加代码;

wxml:

js:

'use strict';import {html2json} from '../src/html2json';//按实际工程目录结构Page({ data: { innerHTML: html2json('

ab

c

'/*需要转的html*/).child }, ...});

wxss:

@import "../src/html2wxml.wxss";//按实际工程目录结构

TIP:

在example.wxss中,可自定义添加修改html标签对应的样式,以满足不同的需求,也欢迎提供全面的样式提交pull request。

标签列表:

[ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'abbr', 'address', 'applet', 'acronym', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'keygen', 'kbd', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'ruby', 's', 'samp', 'script', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr', 'rt', 'section']

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:VGGFace2数据集
下一篇:Win10自带的SSH客户端
相关文章

 发表评论

暂时没有评论,来抢沙发吧~