index.ts 516 B

123456789101112131415161718192021
  1. import { computed, ref } from 'vue'
  2. // import { useGlobalConfig } from '../use-global-config'
  3. const zIndex = ref(0)
  4. export const useZIndex = () => {
  5. // const initialZIndex = useGlobalConfig('zIndex', 2000) // TODO: move to @element-plus/constants
  6. const initialZIndex = ref(1000)
  7. const currentZIndex = computed(() => initialZIndex.value + zIndex.value)
  8. const nextZIndex = () => {
  9. zIndex.value++
  10. return currentZIndex.value
  11. }
  12. return {
  13. initialZIndex,
  14. currentZIndex,
  15. nextZIndex,
  16. }
  17. }