Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[comp:other] add component watermark #924

Closed
1 task done
tuchg opened this issue May 24, 2022 · 2 comments
Closed
1 task done

[comp:other] add component watermark #924

tuchg opened this issue May 24, 2022 · 2 comments
Assignees

Comments

@tuchg
Copy link
Contributor

tuchg commented May 24, 2022

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

当页面需要添加水印标识版权、内部系统防泄密追责等时需使用

What does the proposed API look like?

IxWatermark

WatermarkProps

名称 说明 类型 默认值 全局配置 备注
mode 水印类型 'text' | 'multiline' | 'image' 'text' - 不同的类型需要的content数据不同
content 水印内容 string | string[] - - 根据mode值传入相应内容:
text: 单行文本水印
multiline: 用于支持多行文本 对应content需传入字符串数组
image: 图像水印 建议使用2倍或3倍图
rotate 水印旋转角度 Number -22 单位:度
zIndex 水印层叠顺序 Number 10
alpha 水印透明度 Number 1 默认透明度已由fontColor控制
strict 防篡改 Boolean false 一定程度上的防水印篡改
contentGap 多行文本之间的行间距 Number 22
verticalGap 垂直方向的水印间距 Number 222
horizontalGap 水平方向的水印间距 Number 212
offsetLeft 左偏移量 Number 默认根据水印间距居中处理
offsetTop 上偏移量 Number 默认根据水印间距居中处理
fontColor 字体颜色 String rgba(0,0,0,.15)
fontStyle 字体样式 'none' | 'normal' | 'italic' | 'oblique' normal
fontWeight 字体粗细 'normal'| 'light'| 'weight'| number normal
fontSize 字体大小 Number 16
fontFamily 字体族 String sans-serif
width 水印宽度 Number 120
height 水印高度 Number 64

WatermarkMethods

名称 说明 参数类型 备注
- - - -
<template>
  <IxWatermark content="@iDux">
    <div style="width: 500px; height: 500px">
      test test @test
      <br />
      idux idux idux
    </div>
  </IxWatermark>
</template>

image

@danranVm
Copy link
Member

建议下面几个 API 可能需要稍微调整下:

  • mode => type, 类型改为 'text' | 'image', 是否支持多行直接根据 content 是不是数组来判断就好了。
  • alpha => opacity, 意思取个反?感觉 opacity 这个词常见一些。
  • contentGap => 先不提供吧,直接通过样式去控制就好了?
  • verticalGap => gapVertical
  • horizontalGap => gapHorizontal

最后,我想知道这些样式的 API,有没有可能让用户配一个 class 的方式直接去自定义?比这种一个一个传是不是方便些。

@tuchg
Copy link
Contributor Author

tuchg commented May 24, 2022

建议下面几个 API 可能需要稍微调整下:

  • mode => type, 类型改为 'text' | 'image', 是否支持多行直接根据 content 是不是数组来判断就好了。
  • alpha => opacity, 意思取个反?感觉 opacity 这个词常见一些。
  • contentGap => 先不提供吧,直接通过样式去控制就好了?
  • verticalGap => gapVertical
  • horizontalGap => gapHorizontal

最后,我想知道这些样式的 API,有没有可能让用户配一个 class 的方式直接去自定义?比这种一个一个传是不是方便些。

暴露的大部分样式都为canvas参数要求,是不得已暴露的,字体方面的api应该可以收敛下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants