| 123456789101112131415161718192021222324252627282930 |
- import Taro from "@tarojs/taro";
- class ToastUtil {
- private static instance: ToastUtil | null = null;
- private constructor() { }
- static getInstance(): ToastUtil {
- if (!ToastUtil.instance) {
- ToastUtil.instance = new ToastUtil();
- }
- return ToastUtil.instance;
- }
- private lastTime:number = 0;
- showToast(message: string) {
- if (new Date().getTime() - this.lastTime < 30*1000) {
- return;
- }
-
- Taro.showToast({
- icon: "none",
- title: message,
- });
- this.lastTime = new Date().getTime();
- }
- }
- export default ToastUtil;
|