Skip to content

Commit

Permalink
fix: 修复 FormDynamiac 渲染失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondYuan committed Feb 20, 2024
1 parent 56640a5 commit 2140465
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion compiled/alipay/demo/pages/FormDynamic/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a:for="{{ list }}"
a:for-index="index"
a:for-item="item"
a:key="{{ item.id }}">
a:key="id">
<ant-form-input
label="{{ list[index].id }}"
name="account{{ list[index].id }}"
Expand Down
2 changes: 1 addition & 1 deletion compiled/wechat/demo/pages/FormDynamic/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
wx:for="{{ list }}"
wx:for-index="index"
wx:for-item="item"
wx:key="{{ item.id }}">
wx:key="id">
<ant-form-input
label="{{ list[index].id }}"
name="account{{ list[index].id }}"
Expand Down
7 changes: 6 additions & 1 deletion compiled/wechat/src/Form/FormInput/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@
slot="tooltip">
<slot name="tooltip" />
</view>
<view slot="extra">{{ extra }}</view>
<view slot="extra">
<block wx:if="{{ extra }}">{{ extra }}</block>
<slot
wx:else
name="extra" />
</view>
<view
slot="header"
slot-scope="item">
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/FormDynamic/index.axml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default ({ list }) => (
<Page>
{list.map((item, index) => (
<AntFormInput
key={item.id}
key={"id"}
label={list[index].id}
name={`account${list[index].id}`}
required
Expand Down
11 changes: 5 additions & 6 deletions src/Form/FormInput/index.axml.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, InternalData, Slot, TSXMLProps, View } from 'tsxml';
import { Component, InternalData, Slot, TSXMLProps, View, Block } from 'tsxml';
import AntInput from '../../Input/index.axml';
import FormItem from '../FormItem/index.axml';
import { FormInputProps } from './props'; // assuming the props file is in the same directory
Expand Down Expand Up @@ -82,12 +82,11 @@ export default (
</View>
)}
<View slot="extra">
{/* #if WECHAT */}
{extra ? <Block>{extra}</Block> : <Slot name="extra"></Slot>}
{/* #endif */}
{/* #if ALIPAY */}
<Slot name="extra">
{/* #endif */}
{extra}
{/* #if ALIPAY */}
</Slot>
<Slot name="extra">{extra}</Slot>
{/* #endif */}
</View>
<View slot="header" slot-scope="item">
Expand Down

0 comments on commit 2140465

Please sign in to comment.