Watermark 워터마크
Watermark는 화면 위에 워터마크를 얹는 컴포넌트예요. 텍스트나 이미지로 화면 전체를 덮거나, 일부 영역에만 표시할 수도 있어요.
출처: 문서
본문
설치
@nutui/nutui에서 컴포넌트를 가져와 앱에 등록하면 바로 쓸 수 있어요.
import { createApp } from 'vue'
import { Watermark } from '@nutui/nutui'
const app = createApp()
app.use(Watermark)
사용 예시
기본 사용법
demo: watermark basic
일부 사용
demo: watermark part
여러 줄 워터마크 v4.2.5
content 속성에 문자열 배열을 넘기면 여러 줄 워터마크를 보여줘요.
demo: watermark multi
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| width | Width of watermark | number | 120 |
| height | Height of watermark | number | 64 |
| rotate | Rotation angle when drawing watermark | number | -22 |
| image | Image source, it is recommended to export 2x or 3x images, and the image rendering watermark is preferred | string | - |
| image-width | Width of image | number | 120 |
| image-height | Height of image | number | 64 |
| z-index | Z-index of the appended watermark element | number | 2000 |
| content | Watermark text content | string | string[] | - |
| font-color | Watermark text color | string | rgba(0, 0, 0, .15) |
| font-size | Watermark text font size | string | number | 16 |
| gap-x | Horizontal spacing between watermarks | number | 24 |
| gap-y | Vertical spacing between watermarks | number | 48 |
| full-page | Overwrite entire page | boolean | true |
| font-family | Watermark text font family | string | PingFang SC |
Types v4.3.8
이 컴포넌트는 아래 타입 정의를 함께 내보내요.
import type {
WatermarkProps,
WatermarkInstance
} from '@nutui/nutui'
Theming
CSS Variables
스타일 커스텀에 쓸 수 있는 CSS 변수를 제공해요. 자세한 내용은 ConfigProvider 컴포넌트를 참고하세요.
| Name | Default Value |
|---|---|
| --nut-watermark-z-index | 2000 |
더 알아보기 (Learn more)
- 원문 문서: NutUI Watermark 공식 문서(영문)
- NutUI는 JD.com이 공개한 Vue 3 모바일 컴포넌트 라이브러리예요. 전체 컴포넌트 목록은 공식 문서 사이트에서, 소스 코드는 GitHub 저장소에서 볼 수 있어요.