@element-plus-next/vue-hooks
Version:
Vue hooks for Element Plus.
21 lines (16 loc) • 491 B
text/typescript
import { computed, ref } from 'vue'
import { useGlobalConfig } from '@element-plus-next/vue-context'
const zIndex = ref(0)
export const useZIndex = () => {
const initialZIndex = useGlobalConfig('zIndex', 2000) // TODO: move to @element-plus-next/constants
const currentZIndex = computed(() => initialZIndex.value + zIndex.value)
const nextZIndex = () => {
zIndex.value++
return currentZIndex.value
}
return {
initialZIndex,
currentZIndex,
nextZIndex,
}
}