All Projects → imingyu → wxml-transformer

imingyu / wxml-transformer

Licence: BSD-3-Clause license
将微信小程序的wxml代码转换成js object或html片段

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to wxml-transformer

black horse mall project
品优购,微信小程序电商项目,适合各位拿来学习,可以动动发财的小手点个小star⭐
Stars: ✭ 72 (+300%)
Mutual labels:  wxml, wxapp
Wepy Calendar
微信小程序/wepy/日历组件
Stars: ✭ 58 (+222.22%)
Mutual labels:  wxml, wxapp
weixinCustomerService
主要使用了微信小程序的客服接口,通过将用户输入的消息发送至自己服务器端。 此服务器端用于接收和存储聊天内容,并且提供简单的查看历史资料和模拟客服发送消息的功能。
Stars: ✭ 53 (+194.44%)
Mutual labels:  wxml, wxapp
Tina
💃 一款轻巧的渐进式微信小程序框架
Stars: ✭ 1,153 (+6305.56%)
Mutual labels:  wxml, wxapp
Hswiper Wx
微信小程序swiper插件
Stars: ✭ 167 (+827.78%)
Mutual labels:  wxml, wxapp
Weapp
🐧 微信小程序组件和功能封装,基于微信Component自定义组件开发
Stars: ✭ 235 (+1205.56%)
Mutual labels:  wxml, wxapp
Autocomplete Wx
一款atom插件,支持微信语法高亮和代码补全
Stars: ✭ 47 (+161.11%)
Mutual labels:  wxml, wxapp
Awesome Wechat Weapp
微信小程序开发资源汇总 💯
Stars: ✭ 36,769 (+204172.22%)
Mutual labels:  wxml, wxapp
Wxapp toutiaonews
📰微信小程序--头条新闻
Stars: ✭ 119 (+561.11%)
Mutual labels:  wxml, wxapp
Wxapp Redux Starter
微信小程序,集成redux,并且提供了方便快捷的开发环境;内置好奇心日报Demo...
Stars: ✭ 205 (+1038.89%)
Mutual labels:  wxml, wxapp
wxfortune
运势小程序,使用canvas绘画图片,并保存图片
Stars: ✭ 79 (+338.89%)
Mutual labels:  wxml, wxapp
Kevinpro-NLP-demo
All NLP you Need Here. 个人实现了一些好玩的NLP demo,目前包含13个NLP应用的pytorch实现
Stars: ✭ 117 (+550%)
Mutual labels:  transformer
TDRG
Transformer-based Dual Relation Graph for Multi-label Image Recognition. ICCV 2021
Stars: ✭ 32 (+77.78%)
Mutual labels:  transformer
sticker2
Further developed as SyntaxDot: https://github.com/tensordot/syntaxdot
Stars: ✭ 14 (-22.22%)
Mutual labels:  transformer
wxBase64
🏗️在小程序中使用 js-base64 库
Stars: ✭ 19 (+5.56%)
Mutual labels:  wxapp
Transformer-Transducer
PyTorch implementation of "Transformer Transducer: A Streamable Speech Recognition Model with Transformer Encoders and RNN-T Loss" (ICASSP 2020)
Stars: ✭ 61 (+238.89%)
Mutual labels:  transformer
ICON
(TPAMI2022) Salient Object Detection via Integrity Learning.
Stars: ✭ 125 (+594.44%)
Mutual labels:  transformer
learningspoons
nlp lecture-notes and source code
Stars: ✭ 29 (+61.11%)
Mutual labels:  transformer
Graphormer
Graphormer is a deep learning package that allows researchers and developers to train custom models for molecule modeling tasks. It aims to accelerate the research and application in AI for molecule science, such as material design, drug discovery, etc.
Stars: ✭ 1,194 (+6533.33%)
Mutual labels:  transformer
jhw-wx-app
微信小程序(简单)-通用模板商城
Stars: ✭ 23 (+27.78%)
Mutual labels:  wxapp

wxml-transformer

将微信小程序的wxml代码转换成js object或html片段

注意:此工具单独使用无任何意义,因为默认配置中,wxml标签的相关属性名和值都会原封不动的传递给转换后的html标签,所以转换后的html不拥有功能,只拥有结构;不过此工具可以供其他解决方案使用,如:存在一种将小程序应用直接转换成vue/react/angular单页应用的解决方案。

Build Status image image image

安装

npm i wxml-transformer --save-dev

使用

var transformer = require('wxml-transformer');
transformer.toHtml('<view id="box">{{123}}</view>');
//<div id="box">{{123}}</div>


var options = {
    mapping: {
        view: 'section',
        text: (element, helper) => {
            return `<span data-wxa="text" ${helper.propsStringify(element.props)}>` +
                `${helper.childrenStringify(element.children, options)}</span>`;
        }
    }
};
transformer.toHtml('<view id="box">{{123}} <text id="t1">456</text></view>', options);
//<section id="box">{{123}} <span data-wxa="text" id="t1">456</span></section>

transformer.toObject('<view id="box">{{123}}</view>');
//{tag:'view', props:[{name:'id', value:'box'}], children:[ {'{{123}}'} ]}

transformer.toObject('<view id="box" hidden>{{123}}</view>');
//{tag:'view', props:[{name:'id', value:'box'}, {name:'hidden', onlyName:true}], children:[ {'{{123}}'} ]}

更新日志

v0.1.3

v0.1.2

  • toObject方法转换后的结果中props不在是一个object,而是一个Array,结构为:[{name:String, value:String, onlyName:Boolean}];
  • toObject支持将无属性值的属性添加特殊标记,以供后续程序使用,特殊标记为onlyName,是个Boolean值;

v0.1.0 ~ v0.1.1

初步功能,包括:

  • wxml转换成object;
  • wxml转换成html;
  • object转换成html;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].