Skip to content

Commit ae76410

Browse files
committed
fix: 类型
1 parent 61fc0ff commit ae76410

38 files changed

+126
-102
lines changed

src/packages/address/address.taro.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const InternalAddress: ForwardRefRenderFunction<
131131
<CustomRender
132132
visible={innerVisible}
133133
closeable
134-
title={title || locale.address.selectRegion}
134+
title={title || locale.address?.selectRegion}
135135
left={renderLeftOnCustomSwitch()}
136136
defaultValue={defaultValue}
137137
closeIcon={closeIcon}
@@ -152,7 +152,7 @@ const InternalAddress: ForwardRefRenderFunction<
152152
round
153153
closeable
154154
closeIcon={closeIcon}
155-
title={title || locale.address.selectRegion}
155+
title={title || locale.address?.selectRegion}
156156
onClose={handleClose}
157157
>
158158
<View

src/packages/address/address.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const InternalAddress: ForwardRefRenderFunction<
129129
<CustomRender
130130
visible={innerVisible}
131131
closeable
132-
title={title || locale.address.selectRegion}
132+
title={title || locale.address?.selectRegion}
133133
left={renderLeftOnCustomSwitch()}
134134
defaultValue={defaultValue}
135135
closeIcon={closeIcon}
@@ -150,7 +150,7 @@ export const InternalAddress: ForwardRefRenderFunction<
150150
round
151151
closeable
152152
closeIcon={closeIcon}
153-
title={title || locale.address.selectRegion}
153+
title={title || locale.address?.selectRegion}
154154
onClose={handleClose}
155155
>
156156
<div

src/packages/address/existRender.taro.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const ExistRender: FunctionComponent<
110110
</ul>
111111
</ScrollView>
112112

113-
{(custom || (custom && locale.address.chooseAnotherAddress)) && (
113+
{(custom || (custom && locale.address?.chooseAnotherAddress)) && (
114114
<View className={`${classPrefix}-footer`} onClick={onClick}>
115115
<View className={`${classPrefix}-footer-btn`}>{custom}</View>
116116
</View>

src/packages/address/existRender.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const ExistRender: FunctionComponent<
106106
)
107107
})}
108108
</ul>
109-
{(custom || (custom && locale.address.chooseAnotherAddress)) && (
109+
{(custom || (custom && locale.address?.chooseAnotherAddress)) && (
110110
<div className={`${classPrefix}-footer`} onClick={onClick}>
111111
<div className={`${classPrefix}-footer-btn`}>{custom}</div>
112112
</div>

src/packages/audio/audio.taro.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const Audio: FunctionComponent<
7373
})
7474
audioCtx.onEnded(() => {
7575
if (loop) {
76-
console.warn(locale.audio.tips || 'onPlayEnd事件在loop=false时才会触发')
76+
console.warn(locale.audio?.tips || 'onPlayEnd事件在loop=false时才会触发')
7777
} else {
7878
onPlayEnd?.(audioCtx)
7979
}
@@ -191,20 +191,18 @@ export const Audio: FunctionComponent<
191191
className="back"
192192
onClick={handleBack}
193193
>
194-
{locale.audio.back || '快退'}
194+
{locale.audio?.back}
195195
</Button>
196196
<Button
197197
type="primary"
198198
size="small"
199199
className="start"
200200
onClick={handleStatusChange}
201201
>
202-
{playing
203-
? `${locale.audio.pause || '暂停'}`
204-
: `${locale.audio.start || '开始'}`}
202+
{playing ? `${locale.audio?.pause}` : `${locale.audio?.start}`}
205203
</Button>
206204
<Button type="primary" size="small" onClick={handleForward}>
207-
{locale.audio.forward || '快进'}
205+
{locale.audio?.forward}
208206
</Button>
209207
</View>
210208
</>

src/packages/audio/audio.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const Audio: FunctionComponent<
6868
const classPrefix = 'nut-audio'
6969
const handleEnded = (e: SyntheticEvent<HTMLAudioElement>) => {
7070
if (loop) {
71-
console.warn(locale.audio.tips || 'onPlayEnd事件在loop=false时才会触发')
71+
console.warn(locale.audio?.tips || 'onPlayEnd事件在loop=false时才会触发')
7272
} else {
7373
onEnd?.(e)
7474
}
@@ -183,20 +183,18 @@ export const Audio: FunctionComponent<
183183
className="back"
184184
onClick={handleBack}
185185
>
186-
{locale.audio.back || '快退'}
186+
{locale.audio?.back}
187187
</Button>
188188
<Button
189189
type="primary"
190190
size="small"
191191
className="start"
192192
onClick={handleStatusChange}
193193
>
194-
{playing
195-
? `${locale.audio.pause || '暂停'}`
196-
: `${locale.audio.start || '开始'}`}
194+
{playing ? `${locale.audio?.pause}` : `${locale.audio?.start}`}
197195
</Button>
198196
<Button type="primary" size="small" onClick={handleForward}>
199-
{locale.audio.forward || '快进'}
197+
{locale.audio?.forward}
200198
</Button>
201199
<Button
202200
type={
@@ -205,7 +203,7 @@ export const Audio: FunctionComponent<
205203
size="small"
206204
onClick={handleMute}
207205
>
208-
{locale.audio.mute || '静音'}
206+
{locale.audio?.mute}
209207
</Button>
210208
</div>
211209
</>

src/packages/avatarcropper/avatarcropper.taro.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const AvatarCropper: FunctionComponent<
4747
{locale.cancel}
4848
</Button>,
4949
<Button key="reset">{locale.reset}</Button>,
50-
<Button key="rotate">{locale.avatarCropper.rotate}</Button>,
50+
<Button key="rotate">{locale.avatarCropper?.rotate}</Button>,
5151
<Button type="success" key="confirm">
5252
{locale.confirm}
5353
</Button>,

src/packages/avatarcropper/avatarcropper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const AvatarCropper: FunctionComponent<
4444
{locale.cancel}
4545
</Button>,
4646
<Button key="reset">{locale.reset}</Button>,
47-
<Button key="rotate">{locale.avatarCropper.rotate}</Button>,
47+
<Button key="rotate">{locale.avatarCropper?.rotate}</Button>,
4848
<Button type="success" key="confirm">
4949
{locale.confirm}
5050
</Button>,
@@ -458,7 +458,7 @@ export const AvatarCropper: FunctionComponent<
458458
accept="image/*"
459459
className={`${classPrefix}-input`}
460460
onChange={(e: any) => inputImageChange(e)}
461-
aria-label={locale.avatarCropper.selectImage}
461+
aria-label={locale.avatarCropper?.selectImage}
462462
/>
463463
<div className="nut-avatar-cropper-edit-text">{editText}</div>
464464
</div>

src/packages/calendar/calendar.taro.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ export const Calendar = React.forwardRef<
113113
type={type}
114114
autoBackfill={autoBackfill}
115115
popup={popup}
116-
title={title || locale.calendaritem.title}
116+
title={title || locale.calendaritem?.title}
117117
defaultValue={defaultValue}
118118
startDate={startDate}
119119
endDate={endDate}
120120
showToday={showToday}
121-
startText={startText || locale.calendaritem.start}
122-
endText={endText || locale.calendaritem.end}
123-
confirmText={confirmText || locale.calendaritem.confirm}
121+
startText={startText || locale.calendaritem?.start}
122+
endText={endText || locale.calendaritem?.end}
123+
confirmText={confirmText || locale.calendaritem?.confirm}
124124
showTitle={showTitle}
125125
showSubTitle={showSubTitle}
126126
scrollAnimation={scrollAnimation}

src/packages/calendar/calendar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,14 @@ export const Calendar = React.forwardRef<
114114
autoBackfill={autoBackfill}
115115
renderBottomButton={renderBottomButton}
116116
popup={popup}
117-
title={title || locale.calendaritem.title}
117+
title={title || locale.calendaritem?.title}
118118
defaultValue={defaultValue}
119119
startDate={startDate}
120120
endDate={endDate}
121121
showToday={showToday}
122-
startText={startText || locale.calendaritem.start}
123-
endText={endText || locale.calendaritem.end}
124-
confirmText={confirmText || locale.calendaritem.confirm}
122+
startText={startText || locale.calendaritem?.start}
123+
endText={endText || locale.calendaritem?.end}
124+
confirmText={confirmText || locale.calendaritem?.confirm}
125125
showTitle={showTitle}
126126
showSubTitle={showSubTitle}
127127
scrollAnimation={scrollAnimation}

0 commit comments

Comments
 (0)