1.生成入口
<template>
<div >
<Watermark text="xxx" />
</div>
</template>
2. npmi watermark 并 引入watermark
import Watermark from 'vue-watermark'
export default {
name: 'xxx',
components: {
Watermark,
},
...
}
3.样式
.watermark{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
pointer-events: none;
user-select: none;
opacity: 0.45; /* 调整透明度 */
transform: rotate(-45deg); /* 调整旋转角度 */
white-space: nowrap;
fontSize:80px;
}