|
@@ -2,8 +2,6 @@ import type { Watermark, WatermarkOptions } from 'watermark-js-plus';
|
|
|
|
|
|
import { nextTick, onUnmounted, readonly, ref } from 'vue';
|
|
import { nextTick, onUnmounted, readonly, ref } from 'vue';
|
|
|
|
|
|
-import { updatePreferences } from '@vben/preferences';
|
|
|
|
-
|
|
|
|
const watermark = ref<Watermark>();
|
|
const watermark = ref<Watermark>();
|
|
const unmountedHooked = ref<boolean>(false);
|
|
const unmountedHooked = ref<boolean>(false);
|
|
const cachedOptions = ref<Partial<WatermarkOptions>>({
|
|
const cachedOptions = ref<Partial<WatermarkOptions>>({
|
|
@@ -48,7 +46,6 @@ export function useWatermark() {
|
|
...options,
|
|
...options,
|
|
};
|
|
};
|
|
watermark.value = new Watermark(cachedOptions.value);
|
|
watermark.value = new Watermark(cachedOptions.value);
|
|
- updatePreferences({ app: { watermark: true } });
|
|
|
|
await watermark.value?.create();
|
|
await watermark.value?.create();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -69,7 +66,6 @@ export function useWatermark() {
|
|
watermark.value.destroy();
|
|
watermark.value.destroy();
|
|
watermark.value = undefined;
|
|
watermark.value = undefined;
|
|
}
|
|
}
|
|
- updatePreferences({ app: { watermark: false } });
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// 只在第一次调用时注册卸载钩子,防止重复注册以致于在路由切换时销毁了水印
|
|
// 只在第一次调用时注册卸载钩子,防止重复注册以致于在路由切换时销毁了水印
|