ant-design-vue/components/_util/wave/useWave.ts
puppetkkk d140523c89
fix: useWave unref (#7108)
* fix: useWave unref

* fix: wave init value

* fix: wave value

* Update useConfigInject.ts

---------

Co-authored-by: pangzebang <pangzebang@dm-ai.com>
Co-authored-by: tangjinzhou <415800467@qq.com>
2023-12-18 10:41:50 +08:00

22 lines
527 B
TypeScript

import type { ComponentInternalInstance, ComputedRef, Ref } from 'vue';
import { findDOMNode } from '../props-util';
import showWaveEffect from './WaveEffect';
export default function useWave(
instance: ComponentInternalInstance | null,
className: Ref<string>,
wave?: ComputedRef<{ disabled?: boolean }>,
): VoidFunction {
function showWave() {
const node = findDOMNode(instance);
if (wave?.value?.disabled || !node) {
return;
}
showWaveEffect(node, className.value);
}
return showWave;
}