mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types: using InjectionKey in composables (#8976)
This commit is contained in:
parent
5c080f3a6e
commit
8bc924ea62
@ -1,13 +1,10 @@
|
||||
import { inject, watch } from 'vue';
|
||||
import { inject, InjectionKey, watch } from 'vue';
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const POPUP_TOGGLE_KEY = Symbol();
|
||||
export const POPUP_TOGGLE_KEY: InjectionKey<() => boolean> = Symbol();
|
||||
|
||||
export function onPopupReopen(callback: () => void) {
|
||||
const popupToggleStatus = inject<(() => boolean) | null>(
|
||||
POPUP_TOGGLE_KEY,
|
||||
null
|
||||
);
|
||||
const popupToggleStatus = inject(POPUP_TOGGLE_KEY, null);
|
||||
|
||||
if (popupToggleStatus) {
|
||||
watch(popupToggleStatus, (show) => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { inject, ComputedRef } from 'vue';
|
||||
import { inject, ComputedRef, InjectionKey } from 'vue';
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const TAB_STATUS_KEY = Symbol();
|
||||
export const TAB_STATUS_KEY: InjectionKey<ComputedRef<boolean>> = Symbol();
|
||||
|
||||
export function useTabStatus() {
|
||||
return inject<ComputedRef<boolean> | null>(TAB_STATUS_KEY, null);
|
||||
return inject(TAB_STATUS_KEY, null);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user