Skip to content

Commit 830366d

Browse files
author
xiaoyatong
committed
feat: 修改taro 实现下的div标签等
1 parent cf4e118 commit 830366d

File tree

4 files changed

+43
-38
lines changed

4 files changed

+43
-38
lines changed

src/packages/datepicker/demo.taro.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import Taro from '@tarojs/taro'
3+
import { ScrollView, View } from '@tarojs/components'
34
import Header from '@/sites/components/header'
45
import { useTranslate } from '@/sites/assets/locale/taro'
56
import Demo1 from './demos/taro/demo1'
@@ -48,24 +49,24 @@ const DatePickerDemo = () => {
4849
return (
4950
<>
5051
<Header />
51-
<div className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
52-
<h2>{translated.basic}</h2>
52+
<ScrollView className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
53+
<View className="h2">{translated.basic}</View>
5354
<Demo1 />
54-
<h2>{translated.mmdd}</h2>
55+
<View className="h2">{translated.mmdd}</View>
5556
<Demo2 />
56-
<h2>{translated.showAll}</h2>
57+
<View className="h2">{translated.showAll}</View>
5758
<Demo3 />
58-
<h2>{translated.time}</h2>
59+
<View className="h2">{translated.time}</View>
5960
<Demo4 />
60-
<h2>{translated.hourMinutes}</h2>
61+
<View className="h2">{translated.hourMinutes}</View>
6162
<Demo5 />
62-
<h2>{translated.format}</h2>
63+
<View className="h2">{translated.format}</View>
6364
<Demo6 />
64-
<h2>{translated.stepMins}</h2>
65+
<View className="h2">{translated.stepMins}</View>
6566
<Demo7 />
66-
<h2>{translated.filter}</h2>
67+
<View className="h2">{translated.filter}</View>
6768
<Demo8 />
68-
</div>
69+
</ScrollView>
6970
</>
7071
)
7172
}

src/packages/imagepreview/imagepreview.taro.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import React, {
77
ReactNode,
88
} from 'react'
99
import Taro from '@tarojs/taro'
10-
import { ITouchEvent, Video as TaroVideo, Image } from '@tarojs/components'
10+
import {
11+
ITouchEvent,
12+
Video as TaroVideo,
13+
Image,
14+
View,
15+
} from '@tarojs/components'
1116
import classNames from 'classnames'
1217
import { Close } from '@nutui/icons-react-taro'
1318
import Popup from '@/packages/popup/index.taro'
@@ -271,7 +276,7 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
271276
style={{ width: '100%' }}
272277
onClick={onCloseInner}
273278
>
274-
<div
279+
<View
275280
className={classNames(classPrefix, className)}
276281
style={style}
277282
ref={ref}
@@ -320,7 +325,6 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
320325
key={index}
321326
className="nut-imagepreview-swiper-item"
322327
>
323-
(
324328
<Image
325329
src={item.src}
326330
mode="widthFix"
@@ -330,26 +334,25 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
330334
showMenuByLongpress,
331335
})}
332336
/>
333-
)
334337
</SwiperItem>
335338
)
336339
})
337340
: []
338341
)}
339342
</Swiper>
340-
</div>
343+
</View>
341344
{pagination ? (
342-
<div className={`${classPrefix}-index`}>
345+
<View className={`${classPrefix}-index`}>
343346
{active}/{(images ? images.length : 0) + (videos ? videos.length : 0)}
344-
</div>
347+
</View>
345348
) : null}
346349
{closeIcon !== false ? (
347-
<div
350+
<View
348351
className={`${classPrefix}-close ${closeIconPosition}`}
349352
onClick={onCloseInner}
350353
>
351354
{closeIcon === true ? <Close /> : closeIcon}
352-
</div>
355+
</View>
353356
) : null}
354357
</Popup>
355358
)

src/packages/picker/demo.taro.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react'
22
import Taro from '@tarojs/taro'
3+
import { ScrollView, View } from '@tarojs/components'
34
import { useTranslate } from '@/sites/assets/locale/taro'
45
import Header from '@/sites/components/header'
56
import Demo1 from './demos/taro/demo1'
@@ -48,24 +49,24 @@ const PickerDemo = () => {
4849
return (
4950
<>
5051
<Header />
51-
<div className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
52-
<h2>{translated.basic}</h2>
52+
<ScrollView className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
53+
<View className="h2">{translated.basic}</View>
5354
<Demo1 />
54-
<h2>{translated.defaultSelected}</h2>
55+
<View className="h2">{translated.defaultSelected}</View>
5556
<Demo2 />
56-
<h2>{translated.controlled}</h2>
57+
<View className="h2">{translated.controlled}</View>
5758
<Demo3 />
58-
<h2>{translated.multipleColumns}</h2>
59+
<View className="h2">{translated.multipleColumns}</View>
5960
<Demo4 />
60-
<h2>{translated.tileDesc}</h2>
61+
<View className="h2">{translated.tileDesc}</View>
6162
<Demo5 />
62-
<h2>{translated.cascade}</h2>
63+
<View className="h2">{translated.cascade}</View>
6364
<Demo6 />
64-
<h2>{translated.async}</h2>
65+
<View className="h2">{translated.async}</View>
6566
<Demo7 />
66-
<h2>{translated.theme}</h2>
67+
<View className="h2">{translated.theme}</View>
6768
<Demo8 />
68-
</div>
69+
</ScrollView>
6970
</>
7071
)
7172
}

src/packages/picker/picker.taro.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ const InternalPicker: ForwardRefRenderFunction<
315315

316316
const renderTitleBar = () => {
317317
return (
318-
<div className={`${classPrefix}-control`}>
319-
<span
318+
<View className={`${classPrefix}-control`}>
319+
<View
320320
className={`${classPrefix}-cancel-btn`}
321321
onClick={(e) => {
322322
e.stopPropagation()
@@ -325,18 +325,18 @@ const InternalPicker: ForwardRefRenderFunction<
325325
}}
326326
>
327327
{locale?.cancel}
328-
</span>
329-
<div className={`${classPrefix}-title`}>{title || ''}</div>
330-
<span
328+
</View>
329+
<View className={`${classPrefix}-title`}>{title || ''}</View>
330+
<View
331331
className={`${classPrefix}-confirm-btn`}
332332
onClick={(e) => {
333333
e.stopPropagation()
334334
confirm()
335335
}}
336336
>
337337
{locale.confirm}
338-
</span>
339-
</div>
338+
</View>
339+
</View>
340340
)
341341
}
342342

@@ -389,7 +389,7 @@ const InternalPicker: ForwardRefRenderFunction<
389389
<View className={classes} style={style} {...rest} catchMove>
390390
{renderTitleBar()}
391391
{typeof children !== 'function' && children}
392-
<div className={`${classPrefix}-panel`} ref={pickerRef}>
392+
<View className={`${classPrefix}-panel`} ref={pickerRef}>
393393
{Taro.getEnv() === 'WEB' ? (
394394
columnsList?.map((item, index) => {
395395
return (
@@ -437,7 +437,7 @@ const InternalPicker: ForwardRefRenderFunction<
437437
})}
438438
</PickerView>
439439
)}
440-
</div>
440+
</View>
441441
</View>
442442
</Popup>
443443
</>

0 commit comments

Comments
 (0)