Skip to content

Commit 5ce79c9

Browse files
committed
feat: 修订autoplay属性,并在taro版本上对齐了tc属性值
1 parent 8ba6dfb commit 5ce79c9

File tree

18 files changed

+107
-58
lines changed

18 files changed

+107
-58
lines changed

src/packages/swiper/demos/h5/demo1.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const list = [
1010
const Demo1 = () => {
1111
return (
1212
<div className="demo-box" style={{ height: 150 }}>
13-
<Swiper autoPlay loop indicator>
13+
<Swiper autoplay loop indicator>
1414
{list.map((item, index) => {
1515
return (
1616
<Swiper.Item key={item}>

src/packages/swiper/demos/taro/demo1.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ const Demo1 = () => {
1919
console.log(`onChange is trigger ${e}`)
2020
}
2121
return (
22-
<Swiper defaultValue={1} autoPlay indicator onChange={onChange}>
23-
{list.map((item, index) => (
24-
<Swiper.Item key={item}>
25-
<Image
26-
style={{ width: '100%', height: '100%' }}
27-
onClick={() => console.log(index)}
28-
src={item}
29-
/>
30-
</Swiper.Item>
31-
))}
32-
</Swiper>
22+
<>
23+
<Swiper defaultValue={2} autoplay indicator onChange={onChange}>
24+
{list.map((item, index) => (
25+
<Swiper.Item key={item}>
26+
<Image
27+
style={{ width: '100%', height: '100%' }}
28+
onClick={() => console.log(index)}
29+
src={item}
30+
/>
31+
</Swiper.Item>
32+
))}
33+
</Swiper>
34+
</>
3335
)
3436
}
3537
export default Demo1

src/packages/swiper/demos/taro/demo5.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,24 @@ function Demo5() {
4444
setCurrent2(e.detail.current)
4545
}}
4646
indicator={
47-
<View className="page">
47+
<View
48+
style={{
49+
display: 'flex',
50+
flexDirection: 'row',
51+
justifyContent: 'center',
52+
alignItems: 'center',
53+
position: 'absolute',
54+
left: '85%',
55+
top: pxTransform(120),
56+
width: pxTransform(46),
57+
height: pxTransform(22),
58+
backgroundColor: 'rgba(0, 0, 0, 0.33)',
59+
borderRadius: pxTransform(22),
60+
textAlign: 'center',
61+
fontSize: pxTransform(14),
62+
zIndex: 1,
63+
}}
64+
>
4865
<Text>
4966
{current2 + 1}/{list.length}
5067
</Text>

src/packages/swiper/demos/taro/demo7.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React, { useState } from 'react'
1+
import React from 'react'
22
import { Swiper } from '@nutui/nutui-react-taro'
33
import { Image } from '@tarojs/components'
44

55
const Demo7 = () => {
6-
const [initPage8, setInitPage8] = useState(0)
76
const list = [
87
'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
98
'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',

src/packages/swiper/demos/taro/demo8.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Demo8 = () => {
1010
'https://storage.360buyimg.com/jdc-article/fristfabu.jpg',
1111
]
1212
return (
13-
<View className="demo-box vertical-center">
13+
<View>
1414
<Swiper
1515
defaultValue={0}
1616
direction="vertical"

src/packages/swiper/demos/taro/demo9.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Demo9 = () => {
77
<Swiper
88
height={pxTransform(120)}
99
loop
10-
autoPlay
10+
autoplay
1111
style={{
1212
justifyContent: 'flex-start',
1313
alignItems: 'flex-start',

src/packages/swiper/doc.en-US.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const App = () => {
2929
return (
3030
<div className="demo-box" style={{ height: 150 }}>
3131
<Swiper
32-
autoPlay
32+
autoplay
3333
loop
3434
slideSize={300}
3535
indicator
@@ -428,7 +428,7 @@ export default App
428428
| indicator | Whether the pagination indicator is displayed | `boolean` | `false` |
429429
| loop | Whether to rotate | `boolean` | `true` |
430430
| duration | Animation duration(Unit ms | `number` \| `string` | `500` |
431-
| autoPlay | Automatic rotation duration, 0 means no automatic | `number` \| `string` | `0` |
431+
| autoplay | Automatic rotation duration, 0 means no automatic | `number` \| `string` | `0` |
432432
| defaultValue | Initialize index value | `number` \| `string` | `0` |
433433
| touchable | Is it possible to touch swipe | `boolean` | `true` |
434434
| onChange | Callback after card switching | `(current: number) => void` | `-` |

src/packages/swiper/doc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const App = () => {
3030
return (
3131
<div className="demo-box" style={{ height: 150 }}>
3232
<Swiper
33-
autoPlay
33+
autoplay
3434
loop
3535
slideSize={300}
3636
indicator
@@ -427,7 +427,7 @@ export default App
427427
| indicator | 分页指示器是否展示,可传入自定义的 HTML 结构 | `ReactNode` | `false` |
428428
| loop | 是否循环轮播 | `boolean` | `true` |
429429
| duration | 动画时长(单位是ms) | `number` \| `string` | `500` |
430-
| autoPlay | 自动轮播时长,0表示不会自动轮播 | `number` \| `string` | `0` |
430+
| autoplay | 自动轮播时长,0表示不会自动轮播 | `number` \| `string` | `0` |
431431
| defaultValue | 初始化索引值 | `number` \| `string` | `0` |
432432
| touchable | 是否可触摸滑动 | `boolean` | `true` |
433433
| onChange | 卡片切换后的回调 | `(current: number) => void` | `-` |

src/packages/swiper/doc.taro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ import { Swiper } from '@nutui/nutui-react-taro'
105105
| direction | 轮播方向 | `horizontal` \| `vertical` | `horizontal` |
106106
| indicator | 分页指示器是否展示 | `boolean` | `false` |
107107
| loop | 是否循环轮播 | `boolean` | `true` |
108-
| autoPlay | 自动轮播 | `boolean` | `false` |
108+
| autoplay | 自动轮播 | `boolean` | `false` |
109109
| defaultValue | 初始化索引值 | `number` | `0` |
110110
| onChange | 卡片切换后的回调 | `CommonEventFunction<TaroSwiperProps.onChangeEventDetail>` | `-` |
111111

src/packages/swiper/doc.zh-TW.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const App = () => {
3030
return (
3131
<div className="demo-box" style={{ height: 150 }}>
3232
<Swiper
33-
autoPlay
33+
autoplay
3434
loop
3535
slideSize={300}
3636
indicator

0 commit comments

Comments
 (0)