RollingView 自动滚动容器
将子元素滚动起来,像滚动的公告,就能用这个组件实现
使用这个组件时,组件需要具有高度和宽度,可以直接指定宽高,也可以是 Flex 布局获得的宽高
示例
import { Header, ScrollView, TopView, GroupList, RollingView, Text, px, Column, Row, Image } from '@/duxuiExample'
export default TopView.page(function RollingViewExample() {
return <>
<Header title='RollingView' />
<ScrollView>
<GroupList>
<GroupList.Item title='基础用法' desc='组件需要有宽度和高度,否则将无法运行'>
<RollingView className='bg-warning r-1' style={{ height: px(80) }}>
<Column className='h-full ph-3' justify='center'>
<Text style={{ whiteSpace: 'nowrap' }}>这是公告内容,这个公告将滚动</Text>
</Column>
</RollingView>
</GroupList.Item>
<GroupList.Item title='自定义用法'>
<RollingView className='bg-white r-1' style={{ height: px(160) }}>
<Row className='h-full ph-3 items-center gap-3'>
<Image
src='https://img0.baidu.com/it/u=1684532727,1424929765&fm=253&app=120&size=w931&n=0&f=JPEG&fmt=auto?sec=1681318800&t=50301360a9bd698d5f29da34ffb5cbb0'
style={{ width: px(120) }}
square
/>
<Column className='gap-2'>
<Text bold>这是商品标题</Text>
<Text size={7} bold type='danger'>¥128</Text>
</Column>
</Row>
</RollingView>
</GroupList.Item>
<GroupList.Item title='