| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <template>
- <!-- 水印 -->
- <view class="watermark_big" :style='{height:height?height+"px":"100%"}'>
- <view v-for="(item,index) in num" :key="index">
- <view class="watermark-text" v-if="text != ''" :style="{opacity:opacity}"><text style='color: #efefef;font-size: 26rpx;'>{{text}}</text></view>
- <image class="watermark-img" :src="imgUrl" mode="aspectFill" v-if="imgUrl !='' && text ==''" :style="{opacity:opacity}"></image>
- </view>
- </view>
- </template>
- <script>
- export default {
- name:'wm-watermark',
- props:{
- height:{
- type:Number,//动态设置屏幕高度
- default:0
- },
- text:{ //设置水印文字
- type:String,
- default:''
- },
- imgUrl:{ //设置水印图片
- type:String,
- default:''
- },
- opacity:{ //设置透明度
- type:[Number,String],
- default:0.8
- },
- num:{ //设置水印数量
- type:Number,
- default:6
- }
- },
- data() {
- return {
-
- };
- },
- }
- </script>
- <style scoped>
-
- .watermark_big{
- position: fixed;
- width: 750rpx;
- top:0;
- left: 0;
- bottom: 0;
- right: 0;
- /* pointer-events: none; */
- z-index: 9999;
- /* display: flex; */
- flex-wrap: wrap;
- overflow: hidden;
- flex-direction: column;
- }
- .watermark-text{
- width: 250rpx;
- height: 250rpx;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- transform: rotate(-36deg);
- z-index: 9999;
-
- /* white-space: nowrap; */
- }
- .watermark-img{
- width: 375rpx;
- height: 375rpx;
- z-index: 1;
- }
- </style>
|