diff --git a/packages/uni-components/src/components/checkbox/index.tsx b/packages/uni-components/src/components/checkbox/index.tsx index 384d4ad22f8ff0c19164d95e5b4e68629fa5ffa0..55ea9b96931d07ede9f76b614c37c51d8a829eb1 100644 --- a/packages/uni-components/src/components/checkbox/index.tsx +++ b/packages/uni-components/src/components/checkbox/index.tsx @@ -84,7 +84,10 @@ export default /*#__PURE__*/ defineComponent({ return (
-
+
{checkboxChecked.value ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, color, 16) : ''} diff --git a/packages/uni-h5/dist/uni-h5.esm.js b/packages/uni-h5/dist/uni-h5.esm.js index 4c4557218795b9e904058fadd0f2e3a0d10fcf0a..116f3b9a4e82ed3b6d8da045129df4cfe7e374ee 100644 --- a/packages/uni-h5/dist/uni-h5.esm.js +++ b/packages/uni-h5/dist/uni-h5.esm.js @@ -5419,8 +5419,10 @@ var index$9 = /* @__PURE__ */ defineComponent({ }, [createVNode("div", { class: "uni-checkbox-wrapper" }, [createVNode("div", { - class: "uni-checkbox-input" - }, [checkboxChecked.value ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, color, 16) : ""]), slots.default && slots.default()])], 8, ["disabled", "onClick"]); + class: ["uni-checkbox-input", { + "uni-checkbox-input-disabled": disabled + }] + }, [checkboxChecked.value ? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, color, 16) : ""], 2), slots.default && slots.default()])], 8, ["disabled", "onClick"]); }; } }); @@ -13250,6 +13252,9 @@ function useToastIcon(props2) { let showToastState; let showType = ""; let timeoutId; +const onHidePopupOnce = once(() => { + UniServiceJSBridge.on("onHidePopup", () => hidePopup("onHidePopup")); +}); function createToast(args) { if (!showToastState) { showToastState = reactive(args); @@ -13273,6 +13278,7 @@ function createToast(args) { timeoutId && clearTimeout(timeoutId); } }); + onHidePopupOnce(); } const showToast = defineAsyncApi(API_SHOW_TOAST, (args, {resolve, reject}) => { createToast(args); @@ -13298,7 +13304,7 @@ const hideLoading = defineAsyncApi(API_HIDE_LOADING, (args, {resolve, reject}) = hidePopup("onHideLoading"); resolve(); }); -const hidePopup = (type) => { +function hidePopup(type) { const {t: t2} = useI18n(); if (!showType) { return; @@ -13316,10 +13322,7 @@ const hidePopup = (type) => { setTimeout(() => { showToastState.visible = false; }, 10); -}; -setTimeout(() => { - UniServiceJSBridge.on("onHidePopup", () => hidePopup("onHidePopup")); -}, 0); +} const loadFontFace = defineAsyncApi(API_LOAD_FONT_FACE, ({family, source, desc}, {resolve, reject}) => { addFont(family, source, desc).then(() => { resolve(); diff --git a/packages/uni-h5/src/service/api/ui/popup/showToast.ts b/packages/uni-h5/src/service/api/ui/popup/showToast.ts index d67cd95c0f433a91cd69875c97445b9f2aae5b73..395a874153e84ac21cd717303be8111702634fe8 100644 --- a/packages/uni-h5/src/service/api/ui/popup/showToast.ts +++ b/packages/uni-h5/src/service/api/ui/popup/showToast.ts @@ -24,11 +24,15 @@ import type { API_TYPE_HIDE_LOADING, API_TYPE_SHOW_TOAST, } from '@dcloudio/uni-api' +import { once } from '@dcloudio/uni-shared' //#endregion let showToastState: ToastProps let showType: 'onShowToast' | 'onShowLoading' | '' = '' let timeoutId: number +const onHidePopupOnce = once(() => { + UniServiceJSBridge.on('onHidePopup', () => hidePopup('onHidePopup')) +}) function createToast(args: ToastProps) { if (!showToastState) { @@ -56,6 +60,8 @@ function createToast(args: ToastProps) { timeoutId && clearTimeout(timeoutId) } }) + + onHidePopupOnce() } export const showToast = defineAsyncApi( @@ -103,7 +109,7 @@ export const hideLoading = defineAsyncApi( } ) -const hidePopup = (type: 'onHideToast' | 'onHideLoading' | 'onHidePopup') => { +function hidePopup(type: 'onHideToast' | 'onHideLoading' | 'onHidePopup') { const { t } = useI18n() if (!showType) { return @@ -123,7 +129,3 @@ const hidePopup = (type: 'onHideToast' | 'onHideLoading' | 'onHidePopup') => { showToastState.visible = false }, 10) } - -setTimeout(() => { - UniServiceJSBridge.on('onHidePopup', () => hidePopup('onHidePopup')) -}, 0)