Intro

useCopy 是对 copy-rich-text 的一层状态封装。

Demos

API

查看代码
import type { MaybeRef } from '@vueuse/shared';
import type { CopyOptions } from 'copy-rich-text';
declare type copyBaseProps = CopyOptions & {
    text: MaybeRef<string | HTMLElement>;
    duration?: number;
    onSuccess?: () => void;
    onError?: (error: unknown) => void;
};
export declare function useCopy({ text, duration, onSuccess, onError, ...copyOptions }: copyBaseProps): {
    error: import("vue").Ref<any>;
    copied: import("vue").Ref<boolean>;
    copy(options?: CopyOptions): void;
};
export {};
1
2
3
4
5
6
7
8
9
10
11
12
13
14