index.vue 1.0 KB

12345678910111213141516171819202122232425262728
  1. <template>
  2. <PageWrapper title="水印示例">
  3. <CollapseContainer class="w-full h-32 bg-white rounded-md" title="Global WaterMark">
  4. <a-button type="primary" class="mr-2" @click="setWatermark('WaterMark Info')"> Create </a-button>
  5. <a-button color="error" class="mr-2" @click="clear"> Clear </a-button>
  6. <a-button color="warning" class="mr-2" @click="setWatermark('WaterMark Info New')"> Reset </a-button>
  7. </CollapseContainer>
  8. </PageWrapper>
  9. </template>
  10. <script lang="ts">
  11. import { defineComponent, ref } from 'vue';
  12. import { CollapseContainer } from '/@/components/Container/index';
  13. import { useWatermark } from '/@/hooks/web/useWatermark';
  14. import { PageWrapper } from '/@/components/Page';
  15. export default defineComponent({
  16. components: { CollapseContainer, PageWrapper },
  17. setup() {
  18. const areaRef = ref<Nullable<HTMLElement>>(null);
  19. const { setWatermark, clear } = useWatermark();
  20. return {
  21. setWatermark,
  22. clear,
  23. areaRef,
  24. };
  25. },
  26. });
  27. </script>