133 lines
4.5 KiB
JavaScript
133 lines
4.5 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../../../common/vendor.js");
|
|
require("../../../adapter-vue.js");
|
|
const TUIKit_utils_env = require("../../../utils/env.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "index",
|
|
props: {
|
|
// Whether to display the bottom pop-up dialog box
|
|
show: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
// Whether a mask layer is required, the default is true
|
|
modal: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
// Popup box content area height (excluding mask), default is fit-content
|
|
height: {
|
|
type: String,
|
|
default: "fit-content"
|
|
},
|
|
// Whether the pop-up dialog box can be closed by clicking outside, the default is true
|
|
// uniapp only supports closing the pop-up dialog box by clicking the mask
|
|
closeByClickOutside: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
// The rounded angle of the top border corners is 0px by default, i.e. right angle by default
|
|
borderRadius: {
|
|
type: String,
|
|
default: "0px"
|
|
},
|
|
title: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
// Whether to display the top close button, not displayed by default
|
|
showHeaderCloseButton: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
// Whether to display the submit button at the bottom, not displayed by default
|
|
showFooterSubmitButton: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
// Bottom submit button text, only valid when showFooterSubmitButton is true
|
|
submitButtonContent: {
|
|
type: String,
|
|
default: () => common_vendor.Wt.t("确定")
|
|
}
|
|
},
|
|
emits: ["onOpen", "onClose", "onSubmit"],
|
|
setup(__props, { emit: __emit }) {
|
|
const props = __props;
|
|
const emits = __emit;
|
|
const dialogRef = common_vendor.ref();
|
|
common_vendor.watch(
|
|
() => props.show,
|
|
(newVal, oldVal) => {
|
|
if (newVal === oldVal) {
|
|
return;
|
|
}
|
|
switch (newVal) {
|
|
case true:
|
|
emits("onOpen", dialogRef);
|
|
common_vendor.nextTick$1(() => {
|
|
if (TUIKit_utils_env.isH5 && !TUIKit_utils_env.isUniFrameWork) {
|
|
if (props.closeByClickOutside) {
|
|
common_vendor.O.listen({
|
|
domRefs: dialogRef.value,
|
|
handler: closeBottomPopup
|
|
});
|
|
}
|
|
}
|
|
});
|
|
break;
|
|
case false:
|
|
emits("onClose", dialogRef);
|
|
break;
|
|
}
|
|
}
|
|
);
|
|
const closeBottomPopup = () => {
|
|
if (TUIKit_utils_env.isUniFrameWork || TUIKit_utils_env.isH5) {
|
|
emits("onClose", dialogRef);
|
|
}
|
|
};
|
|
const submit = () => {
|
|
emits("onSubmit");
|
|
closeBottomPopup();
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: props.show
|
|
}, props.show ? common_vendor.e({
|
|
b: !common_vendor.unref(TUIKit_utils_env.isPC)
|
|
}, !common_vendor.unref(TUIKit_utils_env.isPC) ? common_vendor.e({
|
|
c: __props.title || __props.showHeaderCloseButton
|
|
}, __props.title || __props.showHeaderCloseButton ? common_vendor.e({
|
|
d: __props.title
|
|
}, __props.title ? {
|
|
e: common_vendor.t(__props.title)
|
|
} : {}, {
|
|
f: __props.showHeaderCloseButton
|
|
}, __props.showHeaderCloseButton ? {
|
|
g: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("关闭")),
|
|
h: common_vendor.o$1(closeBottomPopup)
|
|
} : {}) : {}, {
|
|
i: __props.showFooterSubmitButton
|
|
}, __props.showFooterSubmitButton ? {
|
|
j: common_vendor.t(__props.submitButtonContent),
|
|
k: common_vendor.o$1(submit)
|
|
} : {}, {
|
|
l: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "bottom-popup-h5-main"),
|
|
m: props.height,
|
|
n: props.borderRadius,
|
|
o: props.borderRadius,
|
|
p: common_vendor.o$1(() => {
|
|
}),
|
|
q: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "bottom-popup-h5"),
|
|
r: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && props.modal && "bottom-popup-modal"),
|
|
s: common_vendor.n(common_vendor.unref(TUIKit_utils_env.isUniFrameWork) && "bottom-popup-uni"),
|
|
t: common_vendor.o$1(closeBottomPopup)
|
|
}) : {}) : {});
|
|
};
|
|
}
|
|
});
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6d2e47d7"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/common/BottomPopup/index.js.map
|