77 lines
3.0 KiB
JavaScript
77 lines
3.0 KiB
JavaScript
"use strict";
|
|
var common_vendor = require("../../../../common/vendor.js");
|
|
var uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
|
var uni_modules_wotDesignUni_components_composables_useChildren = require("../composables/useChildren.js");
|
|
var uni_modules_wotDesignUni_components_wdTabbar_types = require("./types.js");
|
|
require("../common/AbortablePromise.js");
|
|
require("../common/props.js");
|
|
const __default__ = {
|
|
name: "wd-tabbar",
|
|
options: {
|
|
addGlobalClass: true,
|
|
virtualHost: true,
|
|
styleIsolation: "shared"
|
|
}
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
...__default__,
|
|
props: uni_modules_wotDesignUni_components_wdTabbar_types.tabbarProps,
|
|
emits: ["change", "update:modelValue"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const height = common_vendor.ref("");
|
|
const { proxy } = common_vendor.getCurrentInstance();
|
|
const { linkChildren } = uni_modules_wotDesignUni_components_composables_useChildren.useChildren(uni_modules_wotDesignUni_components_wdTabbar_types.TABBAR_KEY);
|
|
linkChildren({
|
|
props,
|
|
setChange
|
|
});
|
|
const rootStyle = common_vendor.computed$1(() => {
|
|
const style = {};
|
|
if (uni_modules_wotDesignUni_components_common_util.isDef(props.zIndex)) {
|
|
style["z-index"] = props.zIndex;
|
|
}
|
|
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)}${props.customStyle}`;
|
|
});
|
|
common_vendor.watch(
|
|
[() => props.fixed, () => props.placeholder],
|
|
() => {
|
|
setPlaceholderHeight();
|
|
},
|
|
{ deep: true, immediate: false }
|
|
);
|
|
common_vendor.onMounted(() => {
|
|
if (props.fixed && props.placeholder) {
|
|
common_vendor.nextTick(() => {
|
|
setPlaceholderHeight();
|
|
});
|
|
}
|
|
});
|
|
function setChange(child) {
|
|
let active = child.name;
|
|
emit("update:modelValue", active);
|
|
emit("change", {
|
|
value: active
|
|
});
|
|
}
|
|
function setPlaceholderHeight() {
|
|
if (!props.fixed || !props.placeholder) {
|
|
return;
|
|
}
|
|
uni_modules_wotDesignUni_components_common_util.getRect(".wd-tabbar", false, proxy).then((res) => {
|
|
height.value = Number(res.height);
|
|
});
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.n(`wd-tabbar wd-tabbar--${_ctx.shape} ${_ctx.customClass} ${_ctx.fixed ? "is-fixed" : ""} ${_ctx.safeAreaInsetBottom ? "is-safe" : ""} ${_ctx.bordered ? "is-border" : ""}`),
|
|
b: common_vendor.s(common_vendor.unref(rootStyle)),
|
|
c: _ctx.fixed && _ctx.placeholder && _ctx.safeAreaInsetBottom && _ctx.shape === "round" ? 1 : "",
|
|
d: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(height.value)
|
|
};
|
|
};
|
|
}
|
|
});
|
|
var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-76ba2fd1"], ["__file", "D:/\u7F51\u6291\u4E91Time/\u79C1\u6D3B/2000\u7B97\u5366/src/uni_modules/wot-design-uni/components/wd-tabbar/wd-tabbar.vue"]]);
|
|
wx.createComponent(Component);
|