<template>
<div style="position: relative; width: 100%; height: 300px; border: 1px solid #d1d5db; border-radius: 8px;" ref="containerRef">
<!-- 模拟内容 -->
<div style="position: absolute; top: 20px; left: 20px; background: white; padding: 16px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); z-index: 10;">
<h5 style="margin: 0 0 8px 0; font-size: 14px; font-weight: 600; color: #374151;">浮层内容 (z-index: 10)</h5>
<p style="margin: 0; font-size: 13px; color: #6b7280;">这个浮层应该在水印之上</p>
</div>
<!-- 水印 -->
<TsWatermark
:container="() => containerRef!"
content="底层水印"
:zIndex="1"
color="rgba(59, 130, 246, 0.1)"
/>
<!-- 高层级水印 -->
<TsWatermark
:container="() => containerRef!"
content="顶层水印"
:zIndex="20"
color="rgba(239, 68, 68, 0.1)"
/>
</div>
</template>
<script setup lang="ts">
import { TsWatermark } from 'tui';
import { ref } from 'vue';
const containerRef = ref<HTMLElement>();
</script>