@opentiny/vue-renderless
Version:
An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
25 lines (24 loc) • 769 B
JavaScript
import "../chunk-G2ADBYYC.js";
const api = ["state"];
const renderless = (props, { reactive, inject, computed, onMounted, onUnmounted, onUpdated }, { vm, emit }) => {
const tabs = inject("tabs", null);
const state = reactive({
currentNav: computed(() => props.currentNav || null),
currentWidth: computed(() => props.currentWidth + "px"),
currentPosition: computed(() => props.currentPosition + "px")
});
const handleTransitionEnd = () => {
tabs.state.currentItem = tabs.state.cacheCurrentItem;
};
onMounted(() => {
vm.$el.addEventListener("transitionend", handleTransitionEnd);
});
onUnmounted(() => {
vm.$el.removeEventListener("transitionend", handleTransitionEnd);
});
return { state };
};
export {
api,
renderless
};