@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
50 lines • 1.95 kB
JavaScript
/* eslint-disable */
import react from 'react';
import { CountUp, Grid, GridItem, Toast } from '@antmjs/vantui';
import { View } from '@tarojs/components';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export default function Demo() {
var CountUpRef = react.useRef();
var handleFinish = function handleFinish() {
Toast.show('count finish');
};
return /*#__PURE__*/_jsxs(View, {
children: [/*#__PURE__*/_jsx(Toast, {
id: "controlCountUp-mess"
}), /*#__PURE__*/_jsx(CountUp, {
startVal: 30,
endVal: 500,
ref: CountUpRef,
onFinish: handleFinish
}), /*#__PURE__*/_jsxs(Grid, {
clickable: true,
columnNum: 4,
children: [/*#__PURE__*/_jsx(GridItem, {
text: "\u5F00\u59CB",
onClick: function onClick() {
var _CountUpRef$current;
return (_CountUpRef$current = CountUpRef.current) === null || _CountUpRef$current === void 0 ? void 0 : _CountUpRef$current.start();
}
}), /*#__PURE__*/_jsx(GridItem, {
text: "\u6682\u505C",
onClick: function onClick() {
var _CountUpRef$current2;
return (_CountUpRef$current2 = CountUpRef.current) === null || _CountUpRef$current2 === void 0 ? void 0 : _CountUpRef$current2.pause();
}
}), /*#__PURE__*/_jsx(GridItem, {
text: "\u7EE7\u7EED",
onClick: function onClick() {
var _CountUpRef$current3;
return (_CountUpRef$current3 = CountUpRef.current) === null || _CountUpRef$current3 === void 0 ? void 0 : _CountUpRef$current3.resume();
}
}), /*#__PURE__*/_jsx(GridItem, {
text: "\u91CD\u7F6E",
onClick: function onClick() {
var _CountUpRef$current4;
return (_CountUpRef$current4 = CountUpRef.current) === null || _CountUpRef$current4 === void 0 ? void 0 : _CountUpRef$current4.reset();
}
})]
})]
});
}