UNPKG

@antmjs/vantui

Version:

一套适用于Taro3及React的vantui组件库

37 lines 974 B
import { View } from '@tarojs/components'; import { Button, Toast } from '@antmjs/vantui'; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; export default function Demo() { var show = function show() { Toast.loading({ duration: 0, // 持续展示 toast message: '倒计时 3 秒', selector: '#customSelector', mask: true }); var second = 3; var timer = setInterval(function () { second--; if (second) { Toast.loading({ message: "\u5012\u8BA1\u65F6 ".concat(second, " \u79D2"), mask: true }); } else { clearInterval(timer); Toast.clear(); } }, 1000); }; return /*#__PURE__*/_jsxs(View, { children: [/*#__PURE__*/_jsx(Button, { type: "info", onClick: show, children: "\u52A8\u6001\u63D0\u793A" }), /*#__PURE__*/_jsx(Toast, { id: "customSelector" })] }); }