1455668754
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
7 additions and
7 deletions
-
src/components/Loading/src/createLoading.ts
-
src/components/Loading/src/useLoading.ts
-
src/directives/loading.ts
|
|
@ -1,4 +1,4 @@ |
|
|
import { VNode, defineComponent, createVNode, render, reactive, h } from 'vue'; |
|
|
import { createVNode, defineComponent, h, reactive, render, VNode } from 'vue'; |
|
|
import type { LoadingProps } from './typing'; |
|
|
import type { LoadingProps } from './typing'; |
|
|
|
|
|
|
|
|
import Loading from './Loading.vue'; |
|
|
import Loading from './Loading.vue'; |
|
|
@ -41,7 +41,7 @@ export function createLoading(props?: Partial<LoadingProps>, target?: HTMLElemen |
|
|
target.appendChild(vm.el as HTMLElement); |
|
|
target.appendChild(vm.el as HTMLElement); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function destory() { |
|
|
function destroy() { |
|
|
container && render(null, container); |
|
|
container && render(null, container); |
|
|
container = vm = null; |
|
|
container = vm = null; |
|
|
} |
|
|
} |
|
|
@ -53,7 +53,7 @@ export function createLoading(props?: Partial<LoadingProps>, target?: HTMLElemen |
|
|
vm, |
|
|
vm, |
|
|
close, |
|
|
close, |
|
|
open, |
|
|
open, |
|
|
destory, |
|
|
destroy, |
|
|
setTip: (tip: string) => { |
|
|
setTip: (tip: string) => { |
|
|
data.tip = tip; |
|
|
data.tip = tip; |
|
|
}, |
|
|
}, |
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
import { unref } from 'vue'; |
|
|
|
|
|
import type { Ref } from 'vue'; |
|
|
import type { Ref } from 'vue'; |
|
|
|
|
|
import { unref } from 'vue'; |
|
|
import { tryOnUnmounted } from '@vueuse/core'; |
|
|
import { tryOnUnmounted } from '@vueuse/core'; |
|
|
import { createLoading } from './createLoading'; |
|
|
import { createLoading } from './createLoading'; |
|
|
import type { LoadingProps } from './typing'; |
|
|
import type { LoadingProps } from './typing'; |
|
|
@ -47,7 +47,7 @@ export function useLoading( |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
tryOnUnmounted(() => { |
|
|
tryOnUnmounted(() => { |
|
|
instance.destory(); |
|
|
instance.destroy(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
return [open, close, setTip]; |
|
|
return [open, close, setTip]; |
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
import { createLoading } from '@/components/Loading'; |
|
|
import { createLoading } from '@/components/Loading'; |
|
|
import type { Directive, App } from 'vue'; |
|
|
import type { App, Directive } from 'vue'; |
|
|
|
|
|
|
|
|
const loadingDirective: Directive = { |
|
|
const loadingDirective: Directive = { |
|
|
mounted(el, binding) { |
|
|
mounted(el, binding) { |
|
|
@ -28,7 +28,7 @@ const loadingDirective: Directive = { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
unmounted(el) { |
|
|
unmounted(el) { |
|
|
el?.instance?.destory(); |
|
|
el?.instance?.destroy(); |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|