| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 | import { createVNode as _createVNode } from "vue";import { ref, defineComponent } from "vue";import { truthProp, numericProp, getZIndexStyle, createNamespace, callInterceptor, makeNumericProp, BORDER_TOP_BOTTOM } from "../utils/index.mjs";import { useChildren } from "@vant/use";import { usePlaceholder } from "../composables/use-placeholder.mjs";const [name, bem] = createNamespace("tabbar");const tabbarProps = {  route: Boolean,  fixed: truthProp,  border: truthProp,  zIndex: numericProp,  placeholder: Boolean,  activeColor: String,  beforeChange: Function,  inactiveColor: String,  modelValue: makeNumericProp(0),  safeAreaInsetBottom: {    type: Boolean,    default: null  }};const TABBAR_KEY = Symbol(name);var stdin_default = defineComponent({  name,  props: tabbarProps,  emits: ["change", "update:modelValue"],  setup(props, {    emit,    slots  }) {    const root = ref();    const {      linkChildren    } = useChildren(TABBAR_KEY);    const renderPlaceholder = usePlaceholder(root, bem);    const enableSafeArea = () => {      var _a;      return (_a = props.safeAreaInsetBottom) != null ? _a : props.fixed;    };    const renderTabbar = () => {      var _a;      const {        fixed,        zIndex,        border      } = props;      return _createVNode("div", {        "ref": root,        "role": "tablist",        "style": getZIndexStyle(zIndex),        "class": [bem({          fixed        }), {          [BORDER_TOP_BOTTOM]: border,          "van-safe-area-bottom": enableSafeArea()        }]      }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);    };    const setActive = (active, afterChange) => {      callInterceptor(props.beforeChange, {        args: [active],        done() {          emit("update:modelValue", active);          emit("change", active);          afterChange();        }      });    };    linkChildren({      props,      setActive    });    return () => {      if (props.fixed && props.placeholder) {        return renderPlaceholder(renderTabbar);      }      return renderTabbar();    };  }});export {  TABBAR_KEY,  stdin_default as default};
 |