@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
54 lines • 1.58 kB
JavaScript
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
/* eslint-disable */
import react from 'react';
import { View } from '@tarojs/components';
import { Swiper, SwiperItem, Image } from '@antmjs/vantui';
import * as COMMON from './common';
import { jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
export default function Demo() {
var images = COMMON.images;
var _react$useState = react.useState(0),
_react$useState2 = _slicedToArray(_react$useState, 2),
current = _react$useState2[0],
setCurrent = _react$useState2[1];
var style = {
position: 'absolute',
bottom: 0,
right: 0,
width: 46,
height: 22,
background: 'rgba(0,0,0,.33)',
borderRadius: 22,
textAlign: 'center',
color: '#fff',
fontSize: 14
};
return /*#__PURE__*/_jsx(View, {
className: "demo-box",
children: /*#__PURE__*/_jsx(Swiper, {
height: 200,
paginationVisible: true,
paginationColor: "#426543",
autoPlay: "3000",
initPage: current,
onChange: function onChange(e) {
return setCurrent(e + 1);
},
pageContent: /*#__PURE__*/_jsxs(View, {
style: style,
children: [" ", current, "/4 "]
}),
children: images.map(function (item, index) {
return /*#__PURE__*/_jsx(SwiperItem, {
children: /*#__PURE__*/_jsx(Image, {
src: item,
fit: "cover",
width: "100%",
height: "200px"
})
}, "swiper#demo4".concat(index));
})
})
});
}