提交 5f85117a 编写于 作者: D DCloud_LXH

fix(h5): 1. UniServiceJSBridge.on tree sharkable in showToast 2. fix checkbox disabled status

上级 77f943f0
......@@ -84,7 +84,10 @@ export default /*#__PURE__*/ defineComponent({
return (
<uni-checkbox disabled={disabled} onClick={_onClick}>
<div class="uni-checkbox-wrapper">
<div class="uni-checkbox-input">
<div
class="uni-checkbox-input"
class={{ 'uni-checkbox-input-disabled': disabled }}
>
{checkboxChecked.value
? createSvgIconVNode(ICON_PATH_SUCCESS_NO_CIRCLE, color, 16)
: ''}
......
......@@ -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();
......
......@@ -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<API_TYPE_SHOW_TOAST>(
......@@ -103,7 +109,7 @@ export const hideLoading = defineAsyncApi<API_TYPE_HIDE_LOADING>(
}
)
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)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册