워터마크
워터마크 (Watermark)
출처: 문서
본문
페이지에 특정 텍스트나 패턴을 추가해 주는 컴포넌트예요. 민감한 화면에 소유권이나 신원을 표시할 때 유용하죠.
기본 사용법
가장 기본적인 형태예요. 별다른 설정 없이도 콘텐츠 영역 위에 워터마크가 그려져요.
여러 줄 워터마크
content에 문자열 배열을 넘기면 여러 줄로 된 텍스트 워터마크를 지정할 수 있어요.
이미지 워터마크
image 속성에 이미지 주소를 지정해서 이미지 워터마크를 쓸 수 있어요. 이미지가 고해상도로 유지되고 늘어나지 않게 하려면 width와 height를 설정하고, 로고 이미지 주소의 가로·세로 2배 이상 크기로 업로드하는 걸 권장해요.
커스텀 설정
파라미터를 직접 조절하면서 워터마크 효과를 미리 볼 수 있어요. Content, Color, FontSize, zIndex, Rotate, Gap, Offset 값을 바꿔가며 확인해 보세요.
.wrapper {
display: flex;
}
.watermark {
display: flex;
flex: auto;
}
.watermark-container {
flex: auto;
}
.form {
width: 330px;
margin-left: 20px;
border-left: 1px solid #eee;
padding-left: 20px;
}
img {
z-index: 10;
width: 100%;
max-width: 300px;
position: relative;
}
API
Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| width | The width of the watermark, the default value of content is its own width | number | 120 |
| height | The height of the watermark, the default value of content is its own height | number | 64 |
| rotate | When the watermark is drawn, the rotation Angle, unit ° | number | -22 |
| z-index | The z-index of the appended watermark element | number | 9 |
| image | Image source, it is recommended to export 2x or 3x image, high priority | string | — |
| content | Watermark text content | string / array | Element Plus |
| font | Text style | Font | Font |
| gap | The spacing between watermarks | array | [100, 100] |
| offset | The offset of the watermark from the upper left corner of the container. The default is gap/2 | array | [gap[0]/2, gap[1]/2] |
Font
| Name | Description | Type | Default |
|---|---|---|---|
| color | font color | string | rgba(0,0,0,.15) |
| fontSize | font size | number / string | 16 |
| fontWeight | font weight | enum | normal |
| fontFamily | font family | string | sans-serif |
| fontGap 2.11.5 | font gap | number | 3 |
| fontStyle | font style | enum | normal |
| textAlign | text align | enum | center |
| textBaseline | text baseline | enum | hanging |
Slots
| Name | Description |
|---|---|
| default | container for adding watermark |