@alipay/axml-transverter
v1.0.1
Published
```js import { TransformCompiler } from '@alipay/axml-transverter';
Downloads
726
Readme
如何使用?
import { TransformCompiler } from '@alipay/axml-transverter';
export const wechatCustomMapping = {
view: {
onTouchStart: 'bind:touchstart',
onTouchMove: 'bind:touchmove',
onTouchEnd: 'bind:touchend',
onAnimationEnd: 'bindanimationend',
},
input: {
onInput: 'bindinput',
onConfirm: 'bindconfirm',
onFocus: 'bindfocus',
onBlur: 'bindblur',
onKeyboardHeightChange: 'bindkeyboardheightchange',
onNicknameReview: 'bindnicknamereview',
},
textarea: {
onInput: 'bindinput',
onConfirm: 'bindconfirm',
onFocus: 'bindfocus',
onBlur: 'bindblur',
},
'checkbox-group': {
onChange: 'bindchange',
},
'ant-textarea': {
onChange: 'bind:change',
},
'ant-slider': {
onAfterChange: 'bind:afterchange',
},
'ant-input': {
onBlur: 'bind:blur',
onConfirm: 'bind:confirm',
onFocus: 'bind:focus',
onChange: 'bind:change',
},
'ant-popup': {
onClose: 'bind:close',
},
'ant-picker': {
onOk: 'bind:ok',
onCancel: 'bind:cancel',
},
'ant-cascader-picker': {
onOk: 'bind:ok',
onCancel: 'bind:cancel',
},
'ant-date-picker': {
onCancel: 'bind:cancel',
onOk: 'bind:ok',
onPickerChange: 'bind:pickerchange',
},
'ant-selector': {
onSelectMin: 'bind:selectmin',
onSelectMax: 'bind:selectmax',
},
'ant-guide-tour': {
onCancel: 'bind:cancel',
},
uploader: {
onPreview: 'bind:preview',
},
'ant-range-picker': {
onOk: 'bind:ok',
},
'ant-action-sheet': {
onAction: 'bind:action',
onClose: 'bind:close',
},
'rare-words-keyboard': {
onClose: 'bind:close',
onError: 'bind:error',
},
'ant-rare-words-keyboard': {
onClose: 'bind:close',
onError: 'bind:error',
},
'ant-modal': {
onPrimaryButtonTap: 'bind:primarybuttontap',
onSecondaryButtonTap: 'bind:secondarybuttontap',
onCancelButtonTap: 'bind:cancelbuttontap',
onClose: 'bind:close',
},
'number-keyboard': {
onClose: 'bind:close',
},
'ant-number-keyboard': {
onClose: 'bind:close',
},
'movable-view': {
onChange: 'bindchange',
onChangeEnd: 'bindchangeend',
catchTouchEnd: 'catch:touchend',
onTouchCancel: 'bind:touchcancel',
catchTouchStart: 'catch:touchstart',
},
'ant-swipe-action': {
onSwipeEnd: 'bind:swipeend',
onSwipeStart: 'bind:swipestart',
onButtonTap: 'bind:buttontap',
},
};
// 转微信
const Compiler = new TransformCompiler(
{
platform: 'WECHAT',
customMapping: WECHAT_MAPPING,
},
[],
);
const transCode = Compiler.compile(axmlCode);
// 转支付宝
const Compiler = new TransformCompiler(
{
platform: 'ALIPAY',
customMapping: {},
},
[],
);
const transCode = Compiler.compile(axmlCode);