vue3-watermark-plugin
Version:
A powerful Vue 3 watermark plugin with component and directive support
45 lines (36 loc) • 1.19 kB
TypeScript
import type { App, Plugin, DirectiveBinding, DefineComponent } from 'vue';
// 水印配置接口
export interface WatermarkConfig {
content?: string;
fontSize?: number;
color?: string;
bold?: boolean;
rotate?: number;
gapX?: number;
gapY?: number;
zIndex?: number;
visible?: boolean;
}
// 水印指令类型
export declare const watermarkDirective: {
mounted(el: HTMLElement, binding: DirectiveBinding<WatermarkConfig>): void;
updated(el: HTMLElement, binding: DirectiveBinding<WatermarkConfig>): void;
beforeUnmount(el: HTMLElement): void;
};
// 水印组件类型
export declare const WatermarkComponent: DefineComponent<WatermarkConfig>;
export declare const Watermark: DefineComponent<WatermarkConfig>;
// 插件安装函数
export declare function install(app: App, options?: { globalConfig?: WatermarkConfig }): void;
// 插件对象
declare const WatermarkPlugin: Plugin & {
WatermarkComponent: typeof WatermarkComponent;
watermarkDirective: typeof watermarkDirective;
};
export default WatermarkPlugin;
// Vue 模块扩展
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$watermarkConfig?: WatermarkConfig;
}
}