SwiperItem
滑块视图容器子项,仅可放置在 swiper 组件中,宽高自动设置为 100%。
导入
import { SwiperItem } from '@ray-js/ray';
示例代码
- index.module.less
.swiper {
width: 702rpx;
height: 200rpx;
}
.swiperItem {
width: 702rpx;
height: 200rpx;
display: block;
}
.nested {
width: 702rpx;
height: 400rpx;
}
.nestedItem {
width: 702rpx;
height: 400rpx;
}
.nestedSwiper {
width: 702rpx;
height: 200rpx;
}
基本使用
import React, { useState } from 'react';
import { View, Swiper, SwiperItem } from '@ray-js/components';
import styles from './index.module.less';
function randomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
export default fun