mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
9.9 KiB
JavaScript
2 lines
9.9 KiB
JavaScript
/*! For license information please see 545.bb452477.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["545"],{92410:function(n,s,a){"use strict";a.r(s);var t=a("80681");let d=["innerHTML"];s.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'<h1>Watermark \u6C34\u5370</h1>\n<div class="van-doc-card"><h3 id="jie-shao" tabindex="-1">\u4ECB\u7ECD</h3>\n<p>\u5728\u9875\u9762\u4E0A\u6DFB\u52A0\u7279\u5B9A\u7684\u6587\u5B57\u6216\u56FE\u6848\u4F5C\u4E3A\u6C34\u5370\uFF0C\u53EF\u7528\u4E8E\u9632\u6B62\u4FE1\u606F\u76D7\u7528\u3002\u8BF7\u5347\u7EA7 <code>vant</code> \u5230 >= 4.2.0 \u7248\u672C\u6765\u4F7F\u7528\u8BE5\u7EC4\u4EF6\u3002</p>\n</div><div class="van-doc-card"><h3 id="yin-ru" tabindex="-1">\u5F15\u5165</h3>\n<p>\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003<a href="#/zh-CN/advanced-usage#zu-jian-zhu-ce" target="_blank">\u7EC4\u4EF6\u6CE8\u518C</a>\u3002</p>\n<pre><code class="language-js"><span class="hljs-keyword">import</span> { createApp } <span class="hljs-keyword">from</span> <span class="hljs-string">'vue'</span>;\n<span class="hljs-keyword">import</span> { <span class="hljs-title class_">Watermark</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n\n<span class="hljs-keyword">const</span> app = <span class="hljs-title function_">createApp</span>();\napp.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">Watermark</span>);\n</code></pre>\n</div><h2 id="dai-ma-yan-shi" tabindex="-1">\u4EE3\u7801\u6F14\u793A</h2>\n<div class="van-doc-card"><h3 id="wen-zi-shui-yin" tabindex="-1">\u6587\u5B57\u6C34\u5370</h3>\n<p>\u901A\u8FC7 <code>content</code> \u5C5E\u6027\u6765\u8BBE\u7F6E\u6C34\u5370\u7684\u6587\u5B57\u3002</p>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-watermark</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"Vant"</span> /></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="tu-pian-shui-yin" tabindex="-1">\u56FE\u7247\u6C34\u5370</h3>\n<p>\u901A\u8FC7 <code>image</code> \u5C5E\u6027\u6765\u8BBE\u7F6E\u6C34\u5370\u56FE\u7247\uFF0C\u5E76\u4F7F\u7528 <code>opacity</code> \u6765\u8C03\u6574\u6C34\u5370\u7684\u6574\u4F53\u900F\u660E\u5EA6\u3002</p>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-watermark</span>\n <span class="hljs-attr">image</span>=<span class="hljs-string">"https://fastly.jsdelivr.net/npm/@vant/assets/vant-watermark.png"</span>\n <span class="hljs-attr">opacity</span>=<span class="hljs-string">"0.2"</span>\n/></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="zi-ding-yi-jian-ge" tabindex="-1">\u81EA\u5B9A\u4E49\u95F4\u9694</h3>\n<p>\u901A\u8FC7 <code>gap-x</code> \u548C <code>gap-y</code> \u5C5E\u6027\u6765\u63A7\u5236\u591A\u4E2A\u91CD\u590D\u6C34\u5370\u4E4B\u95F4\u7684\u95F4\u9694\u3002</p>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-watermark</span>\n <span class="hljs-attr">image</span>=<span class="hljs-string">"https://fastly.jsdelivr.net/npm/@vant/assets/vant-watermark.png"</span>\n <span class="hljs-attr">:gap-x</span>=<span class="hljs-string">"30"</span>\n <span class="hljs-attr">:gap-y</span>=<span class="hljs-string">"10"</span>\n <span class="hljs-attr">opacity</span>=<span class="hljs-string">"0.2"</span>\n/></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="zi-ding-yi-qing-xie-jiao-du" tabindex="-1">\u81EA\u5B9A\u4E49\u503E\u659C\u89D2\u5EA6</h3>\n<p>\u901A\u8FC7 <code>rotate</code> \u5C5E\u6027\u6765\u63A7\u5236\u6C34\u5370\u7684\u503E\u659C\u89D2\u5EA6\uFF0C\u9ED8\u8BA4\u503C\u4E3A<code>-22</code>\u3002</p>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-watermark</span>\n <span class="hljs-attr">image</span>=<span class="hljs-string">"https://fastly.jsdelivr.net/npm/@vant/assets/vant-watermark.png"</span>\n <span class="hljs-attr">rotate</span>=<span class="hljs-string">"22"</span>\n <span class="hljs-attr">opacity</span>=<span class="hljs-string">"0.2"</span>\n/></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="xian-shi-fan-wei" tabindex="-1">\u663E\u793A\u8303\u56F4</h3>\n<p>\u901A\u8FC7 <code>full-page</code> \u5C5E\u6027\u6765\u63A7\u5236\u6C34\u5370\u7684\u663E\u793A\u8303\u56F4\u3002</p>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-watermark</span>\n <span class="hljs-attr">image</span>=<span class="hljs-string">"https://fastly.jsdelivr.net/npm/@vant/assets/vant-watermark.png"</span>\n <span class="hljs-attr">opacity</span>=<span class="hljs-string">"0.2"</span>\n <span class="hljs-attr">:full-page</span>=<span class="hljs-string">"true"</span>\n/></span>\n</code></pre>\n</div><div class="van-doc-card"><h3 id="html-shui-yin" tabindex="-1">HTML \u6C34\u5370</h3>\n<p>\u901A\u8FC7 <code>content</code> \u63D2\u69FD\u53EF\u4EE5\u76F4\u63A5\u4F20\u5165 HTML \u4F5C\u4E3A\u6C34\u5370\u3002HTML \u4E2D\u7684\u6837\u5F0F\u4EC5\u652F\u6301\u884C\u5185\u6837\u5F0F\uFF0C\u540C\u65F6\u4E0D\u652F\u6301\u4F20\u5165\u81EA\u95ED\u5408\u6807\u7B7E\u3002</p>\n<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">van-watermark</span> <span class="hljs-attr">:width</span>=<span class="hljs-string">"150"</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">template</span> #<span class="hljs-attr">content</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"background: linear-gradient(45deg, #000 0, #000 50%, #fff 50%)"</span>></span>\n <span class="hljs-tag"><<span class="hljs-name">p</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"mix-blend-mode: difference; color: #fff"</span>></span>Vant watermark<span class="hljs-tag"></<span class="hljs-name">p</span>></span>\n <span class="hljs-tag"></<span class="hljs-name">div</span>></span>\n <span class="hljs-tag"></<span class="hljs-name">template</span>></span>\n<span class="hljs-tag"></<span class="hljs-name">van-watermark</span>></span>\n</code></pre>\n</div><h2 id="api" tabindex="-1">API</h2>\n<div class="van-doc-card"><h3 id="props" tabindex="-1">Props</h3>\n<table>\n<thead>\n<tr>\n<th>\u53C2\u6570</th>\n<th>\u8BF4\u660E</th>\n<th>\u7C7B\u578B</th>\n<th>\u9ED8\u8BA4\u503C</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>width</td>\n<td>\u6C34\u5370\u5BBD\u5EA6</td>\n<td><em>number</em></td>\n<td><code>100</code></td>\n</tr>\n<tr>\n<td>height</td>\n<td>\u6C34\u5370\u9AD8\u5EA6</td>\n<td><em>number</em></td>\n<td><code>100</code></td>\n</tr>\n<tr>\n<td>z-index</td>\n<td>\u6C34\u5370\u7684 z-index</td>\n<td><em>number | string</em></td>\n<td><code>100</code></td>\n</tr>\n<tr>\n<td>content</td>\n<td>\u6587\u5B57\u6C34\u5370\u7684\u5185\u5BB9</td>\n<td><em>string</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>image</td>\n<td>\u56FE\u7247\u6C34\u5370\u7684\u5185\u5BB9\uFF0C\u5982\u679C\u4E0E <code>content</code> \u540C\u65F6\u4F20\u5165\uFF0C\u4F18\u5148\u4F7F\u7528\u56FE\u7247\u6C34\u5370</td>\n<td><em>string</em></td>\n<td>-</td>\n</tr>\n<tr>\n<td>rotate</td>\n<td>\u6C34\u5370\u7684\u65CB\u8F6C\u89D2\u5EA6</td>\n<td><em>number | string</em></td>\n<td><code>-22</code></td>\n</tr>\n<tr>\n<td>full-page</td>\n<td>\u6C34\u5370\u662F\u5426\u5168\u5C4F\u663E\u793A</td>\n<td><em>boolean</em></td>\n<td><code>false</code></td>\n</tr>\n<tr>\n<td>gap-x</td>\n<td>\u6C34\u5370\u4E4B\u95F4\u7684\u6C34\u5E73\u95F4\u9694</td>\n<td><em>number</em></td>\n<td><code>0</code></td>\n</tr>\n<tr>\n<td>gap-y</td>\n<td>\u6C34\u5370\u4E4B\u95F4\u7684\u5782\u76F4\u95F4\u9694</td>\n<td><em>number</em></td>\n<td><code>0</code></td>\n</tr>\n<tr>\n<td>text-color</td>\n<td>\u6587\u5B57\u6C34\u5370\u7684\u989C\u8272</td>\n<td><em>string</em></td>\n<td><code>#dcdee0</code></td>\n</tr>\n<tr>\n<td>opacity</td>\n<td>\u6C34\u5370\u7684\u900F\u660E\u5EA6</td>\n<td><em>number | string</em></td>\n<td>-</td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="slots" tabindex="-1">Slots</h3>\n<table>\n<thead>\n<tr>\n<th>\u540D\u79F0</th>\n<th>\u8BF4\u660E</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>content</td>\n<td>HTML \u6C34\u5370\u7684\u5185\u5BB9\uFF0C\u4EC5\u652F\u6301\u884C\u5185\u6837\u5F0F\uFF0C\u540C\u65F6\u4E0D\u652F\u6301\u4F20\u5165\u81EA\u95ED\u5408\u6807\u7B7E\uFF0C\u4F18\u5148\u7EA7\u9AD8\u4E8E <code>content</code> \u6216 <code>image</code> \u5C5E\u6027</td>\n</tr>\n</tbody>\n</table>\n</div><div class="van-doc-card"><h3 id="lei-xing-ding-yi" tabindex="-1">\u7C7B\u578B\u5B9A\u4E49</h3>\n<p>\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A</p>\n<pre><code class="language-ts"><span class="hljs-keyword">import</span> <span class="hljs-keyword">type</span> { <span class="hljs-title class_">WaterProps</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'vant'</span>;\n</code></pre>\n</div><h2 id="zhu-ti-ding-zhi" tabindex="-1">\u4E3B\u9898\u5B9A\u5236</h2>\n<div class="van-doc-card"><h3 id="yang-shi-bian-liang" tabindex="-1">\u6837\u5F0F\u53D8\u91CF</h3>\n<p>\u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E0B\u5217 CSS \u53D8\u91CF\uFF0C\u53EF\u7528\u4E8E\u81EA\u5B9A\u4E49\u6837\u5F0F\uFF0C\u4F7F\u7528\u65B9\u6CD5\u8BF7\u53C2\u8003 <a href="#/zh-CN/config-provider" target="_blank">ConfigProvider \u7EC4\u4EF6</a>\u3002</p>\n<table>\n<thead>\n<tr>\n<th>\u540D\u79F0</th>\n<th>\u9ED8\u8BA4\u503C</th>\n<th>\u63CF\u8FF0</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>--van-watermark-z-index</td>\n<td><em>100</em></td>\n<td>\u6839\u8282\u70B9\u7684 z-index \u5C42\u7EA7</td>\n</tr>\n</tbody>\n</table>\n</div>'},null,8,d))}}}]); |