|
| 1 | +<docs> |
| 2 | +--- |
| 3 | +order: 0 |
| 4 | +title: |
| 5 | + zh-CN: 自定义配置 |
| 6 | + en-US: Custom |
| 7 | +--- |
| 8 | + |
| 9 | +## zh-CN |
| 10 | + |
| 11 | +通过自定义参数配置预览水印效果。 |
| 12 | + |
| 13 | +## en-US |
| 14 | + |
| 15 | +Preview the watermark effect by configuring custom parameters. |
| 16 | + |
| 17 | +</docs> |
| 18 | + |
| 19 | +<template> |
| 20 | + <div style="display: flex"> |
| 21 | + <a-watermark v-bind="model"> |
| 22 | + <a-typography> |
| 23 | + <a-typography-paragraph> |
| 24 | + The light-speed iteration of the digital world makes products more complex. However, human |
| 25 | + consciousness and attention resources are limited. Facing this design contradiction, the |
| 26 | + pursuit of natural interaction will be the consistent direction of Ant Design. |
| 27 | + </a-typography-paragraph> |
| 28 | + <a-typography-paragraph> |
| 29 | + Natural user cognition: According to cognitive psychology, about 80% of external |
| 30 | + information is obtained through visual channels. The most important visual elements in the |
| 31 | + interface design, including layout, colors, illustrations, icons, etc., should fully |
| 32 | + absorb the laws of nature, thereby reducing the user's cognitive cost and bringing |
| 33 | + authentic and smooth feelings. In some scenarios, opportunely adding other sensory |
| 34 | + channels such as hearing, touch can create a richer and more natural product experience. |
| 35 | + </a-typography-paragraph> |
| 36 | + <a-typography-paragraph> |
| 37 | + Natural user behavior: In the interaction with the system, the designer should fully |
| 38 | + understand the relationship between users, system roles, and task objectives, and also |
| 39 | + contextually organize system functions and services. At the same time, a series of methods |
| 40 | + such as behavior analysis, artificial intelligence and sensors could be applied to assist |
| 41 | + users to make effective decisions and reduce extra operations of users, to save |
| 42 | + users' mental and physical resources and make human-computer interaction more |
| 43 | + natural. |
| 44 | + </a-typography-paragraph> |
| 45 | + </a-typography> |
| 46 | + <img |
| 47 | + style="z-index: 10; width: 100%; max-width: 800px; position: relative" |
| 48 | + src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ" |
| 49 | + alt="示例图片" |
| 50 | + /> |
| 51 | + </a-watermark> |
| 52 | + <a-form |
| 53 | + style=" |
| 54 | + width: 280px; |
| 55 | + flex-shrink: 0; |
| 56 | + border-left: 1px solid #eee; |
| 57 | + padding-left: 20px; |
| 58 | + margin-left: 20px; |
| 59 | + " |
| 60 | + layout="vertical" |
| 61 | + :model="model" |
| 62 | + > |
| 63 | + <a-form-item name="content" label="Content"> |
| 64 | + <a-input v-model:value="model.content" /> |
| 65 | + </a-form-item> |
| 66 | + <a-form-item name="font.fontSize" label="FontSize"> |
| 67 | + <a-slider v-model:value="model.font.fontSize" :step="1" :min="0" :max="100" /> |
| 68 | + </a-form-item> |
| 69 | + <a-form-item name="zIndex" label="zIndex"> |
| 70 | + <a-slider v-model:value="model.zIndex" :step="1" :min="0" :max="100" /> |
| 71 | + </a-form-item> |
| 72 | + <a-form-item name="rotate" label="Rotate"> |
| 73 | + <a-slider v-model:value="model.rotate" :step="1" :min="-180" :max="180" /> |
| 74 | + </a-form-item> |
| 75 | + <a-form-item label="Gap" style="margin-bottom: 0"> |
| 76 | + <a-space style="display: flex" align="baseline"> |
| 77 | + <a-form-item :name="['gap', 0]"> |
| 78 | + <a-input-number v-model:value="model.gap[0]" placeholder="gapX" /> |
| 79 | + </a-form-item> |
| 80 | + <a-form-item :name="['gap', 1]"> |
| 81 | + <a-input-number v-model:value="model.gap[1]" placeholder="gapY" /> |
| 82 | + </a-form-item> |
| 83 | + </a-space> |
| 84 | + </a-form-item> |
| 85 | + <a-form-item label="Offset" style="margin-bottom: 0"> |
| 86 | + <a-space style="display: flex" align="baseline"> |
| 87 | + <a-form-item :name="['offset', 0]"> |
| 88 | + <a-input-number v-model:value="model.offset[0]" placeholder="offsetLeft" /> |
| 89 | + </a-form-item> |
| 90 | + <a-form-item :name="['offset', 1]"> |
| 91 | + <a-input-number v-model:value="model.offset[1]" placeholder="offsetTop" /> |
| 92 | + </a-form-item> |
| 93 | + </a-space> |
| 94 | + </a-form-item> |
| 95 | + </a-form> |
| 96 | + </div> |
| 97 | +</template> |
| 98 | + |
| 99 | +<script lang="ts"> |
| 100 | +import { defineComponent, reactive } from 'vue'; |
| 101 | +export default defineComponent({ |
| 102 | + setup() { |
| 103 | + const model = reactive({ |
| 104 | + content: 'Ant Design Vue', |
| 105 | + font: { |
| 106 | + fontSize: 16, |
| 107 | + }, |
| 108 | + zIndex: 11, |
| 109 | + rotate: -22, |
| 110 | + gap: [100, 100] as [number, number], |
| 111 | + offset: [], |
| 112 | + }); |
| 113 | + return { |
| 114 | + model, |
| 115 | + }; |
| 116 | + }, |
| 117 | +}); |
| 118 | +</script> |
0 commit comments