Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复使用 babel.config.js 配置 preset-remax 时项目出错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Darmody committed Dec 5, 2019
1 parent fe4d243 commit 9f41119
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 3 deletions.
@@ -0,0 +1 @@
<view>a</view>
@@ -0,0 +1,3 @@
'use strict';

Component({});
@@ -0,0 +1,3 @@
{
"component": true
}
Expand Up @@ -8,6 +8,48 @@
</template>


<template name="REMAX_TPL_1_a-0">
<a-0 ref="{{item.props['__ref']}}">

<block a:for="{{item.children}}" key="{{item.id}}">
<block a:if="{{item.props['slot']}}">
<view slot="{{item.props['slot']}}"
disable-scroll="{{item.props['disable-scroll']}}"
hover-class="{{item.props['hover-class']}}"
hover-start-time="{{item.props['hover-start-time']}}"
hover-stay-time="{{item.props['hover-stay-time']}}"
hidden="{{item.props['hidden']}}"
class="{{item.props['class']}}"
style="{{item.props['style']}}"
animation="{{item.props['animation']}}"
hover-stop-propagation="{{item.props['hover-stop-propagation']}}"
onTap="{{item.props['onTap']}}"
onTouchStart="{{item.props['onTouchStart']}}"
onTouchMove="{{item.props['onTouchMove']}}"
onTouchEnd="{{item.props['onTouchEnd']}}"
onTouchCancel="{{item.props['onTouchCancel']}}"
onLongTap="{{item.props['onLongTap']}}"
onTransitionEnd="{{item.props['onTransitionEnd']}}"
onAnimationIteration="{{item.props['onAnimationIteration']}}"
onAnimationStart="{{item.props['onAnimationStart']}}"
onAnimationEnd="{{item.props['onAnimationEnd']}}"
onAppear="{{item.props['onAppear']}}"
onDisappear="{{item.props['onDisappear']}}"
onFirstAppear="{{item.props['onFirstAppear']}}"
>
<block a:for="{{item.children}}" key="{{item.id}}">
<template is="REMAX_TPL_1_CONTAINER" data="{{item: item}}" />
</block>
</view>
</block>
<block a:else>
<template is="REMAX_TPL_1_CONTAINER" data="{{item: item}}" />
</block>
</block>

</a-0>
</template>

<template name="REMAX_TPL_1_button">
<button app-parameter="{{item.props['app-parameter']}}" class="{{item.props['class']}}" data-rid="{{item.props['data-rid']}}" disabled="{{item.props['disabled']}}" form-type="{{item.props['form-type']}}" hover-class="{{item.props['hover-class']}}" hover-start-time="{{item.props['hover-start-time']}}" hover-stay-time="{{item.props['hover-stay-time']}}" hover-stop-propagation="{{item.props['hover-stop-propagation']}}" loading="{{item.props['loading']}}" onTap="{{item.props['onTap']}}" open-type="{{item.props['open-type']}}" plain="{{item.props['plain']}}" public-id="{{item.props['public-id']}}" scope="{{item.props['scope']}}" size="{{item.props['size']}}" type="{{item.props['type']}}" >

Expand Down
Expand Up @@ -9,6 +9,7 @@ require('../npm/remax/esm/createAppConfig.js');
require('../npm/remax/esm/Platform.js');
require('../npm/remax/esm/createHostComponent.js');
var createPageConfig = require('../npm/remax/esm/createPageConfig.js');
var createNativeComponent = require('../npm/remax/esm/createNativeComponent.js');
require('../npm/remax/esm/index.js');
var View = require('../npm/remax/esm/adapters/alipay/components/View.js');
require('../npm/remax/esm/adapters/alipay/components/ScrollView.js');
Expand Down Expand Up @@ -46,6 +47,8 @@ require('../npm/remax/esm/adapters/alipay/components/ContactButton.js');
require('../npm/remax/esm/adapters/alipay/components/Video.js');
require('../npm/remax/esm/adapters/alipay/api.js');

var A = createNativeComponent.default('a-0');

var _class, _descriptor, _temp;

var N;
Expand Down Expand Up @@ -96,7 +99,7 @@ var c = new C();
c.p = 'a';

var _page = function _page() {
return React.createElement(View.default, null, timesTwo([1, 2, 3]), N.V, N.W, c.p);
return React.createElement(View.default, null, timesTwo([1, 2, 3]), N.V, N.W, c.p, React.createElement(A, null));
};

var index = Page(createPageConfig.default(_page));
Expand Down
@@ -1,3 +1,5 @@
{
"usingComponents": {}
"usingComponents": {
"a-0": "../components/a/index"
}
}
@@ -0,0 +1 @@
<view>a</view>
@@ -0,0 +1 @@
Component({});
@@ -0,0 +1,3 @@
{
"component": true
}
@@ -0,0 +1,5 @@
declare module '@/components/b';
declare module '@/components/a';
declare module '@/components/c';
declare module '@/components/d';
declare module '@/components/g';
@@ -1,4 +1,5 @@
import * as React from 'react';
import A from '@/components/a';
import { View } from 'remax/alipay';

// eslint-disable-next-line @typescript-eslint/no-namespace
Expand Down Expand Up @@ -38,5 +39,6 @@ export default () => (
{N.V}
{N.W}
{c.p}
<A />
</View>
);
2 changes: 1 addition & 1 deletion packages/remax-cli/src/build/plugins/babel.ts
Expand Up @@ -36,7 +36,7 @@ function processPresets(presets: ConfigItem[], babel: any, react: boolean) {
if (remaxPresetIndex === -1) {
presets.unshift(remaxPreset);
} else {
presets[remaxPreset] = remaxPreset;
presets[remaxPresetIndex] = remaxPreset;
}

return presets;
Expand Down

0 comments on commit 9f41119

Please sign in to comment.