Browse Source
* perf(watermark): 消除水印hook类型问题 * feat: 支持设置多重水印,增加清除所有水印方法 * chore: 应该让用户自己来进行水印清除pull/3087/head
committed by
GitHub
2 changed files with 41 additions and 31 deletions
@ -1,33 +1,30 @@ |
|||
<template> |
|||
<PageWrapper title="水印示例"> |
|||
<CollapseContainer class="w-full h-32 bg-white rounded-md" title="Global WaterMark"> |
|||
<a-button type="primary" class="mr-2" @click="setWatermark('WaterMark Info')"> |
|||
Create |
|||
<a-button type="primary" class="mr-2" @click="setWatermark('WaterMark Info1')"> |
|||
Create Watermark1 |
|||
</a-button> |
|||
<a-button color="error" class="mr-2" @click="clear"> Clear </a-button> |
|||
<a-button type="primary" class="mr-2" @click="setWatermark2('WaterMark Info2')"> |
|||
Create Watermark2 |
|||
</a-button> |
|||
<a-button color="error" class="mr-2" @click="clear"> Clear Watermark1 </a-button> |
|||
<a-button color="error" class="mr-2" @click="clearAll"> ClearAll </a-button> |
|||
<a-button color="warning" class="mr-2" @click="setWatermark('WaterMark Info New')"> |
|||
Reset |
|||
Update Watermark1 |
|||
</a-button> |
|||
</CollapseContainer> |
|||
</PageWrapper> |
|||
</template> |
|||
<script lang="ts"> |
|||
import { defineComponent, ref } from 'vue'; |
|||
<script lang="ts" setup> |
|||
import { onUnmounted } from 'vue'; |
|||
import { CollapseContainer } from '/@/components/Container/index'; |
|||
import { useWatermark } from '/@/hooks/web/useWatermark'; |
|||
import { PageWrapper } from '/@/components/Page'; |
|||
import { type Nullable } from '@vben/types'; |
|||
|
|||
export default defineComponent({ |
|||
components: { CollapseContainer, PageWrapper }, |
|||
setup() { |
|||
const areaRef = ref<Nullable<HTMLElement>>(null); |
|||
const { setWatermark, clear } = useWatermark(); |
|||
return { |
|||
setWatermark, |
|||
clear, |
|||
areaRef, |
|||
}; |
|||
}, |
|||
const { setWatermark, clear, clearAll } = useWatermark(); |
|||
const { setWatermark: setWatermark2 } = useWatermark(); |
|||
|
|||
onUnmounted(() => { |
|||
clearAll(); |
|||
}); |
|||
</script> |
|||
|
|||
Loading…
Reference in new issue