vue3如何实现做一个有水印背景效果

571 ℃

如何利用vue3语法实现一个有水印背景效果,下面web建站小编给大家简单介绍一下具体实现代码!

代码如下:

<div v-water-mask:options="wmOption"></div>

const wmOption = reactive<WMOptions>({
  textArr: ['web建站教程', `${dayjs().format('YYYY-MM-DD HH:mm')}`],
  deg: -35,
});
export class WMOptions {
  constructor(init?: WMOptions) {
    if (init) {
      Object.assign(this, init);
    }
  }
  textArr: Array = ['test', '自定义水印']; // 需要展示的文字,多行就多个元素【必填】
  font?: string = '16px "微软雅黑"'; // 字体样式
  fillStyle?: string = 'rgba(170,170,170,0.4)'; // 描边样式
  maxWidth?: number = 200; // 文字水平时最大宽度
  minWidth?: number = 120; // 文字水平时最小宽度
  lineHeight?: number = 24; // 文字行高
  deg?: number = -45; // 旋转的角度 0至-90之间
  marginRight?: number = 120; // 每个水印的右间隔
  marginBottom?: number = 40; // 每个水印的下间隔
  left?: number = 20; // 整体背景距左边的距离
  top?: number = 20; // 整体背景距上边的距离
  opacity?: string = '.75'; // 文字透明度
  position?: 'fixed' | 'absolute' = 'fixed'; // 容器定位方式
}

盘点vue3的各种生命周期

如何在Vue3中使用watch监控一个对象的属性值

Vue3怎么运用pinia状态管理工具

Vue3中文官网介绍

vue3语法如何利用mitt实现兄弟组件传值

标签: v-water-mask, vue3语法, 水印背景

上面是“vue3如何实现做一个有水印背景效果”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。

当前网址:https://m.ipkd.cn/webs_4476.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

nginx根据扩展名限制程序和文件访问禁止访问php?
vue项目打包后自动生成版本号,判断是否清空缓存(亲测有效)
vue代码如何将毫秒转换成日期?
Vue-Router用createRouter创建路由去除#
帝国CMS功能之商城系统在线支付后,订单邮件提