/*! For license information please see 7074.4e85dac2.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["7074"],{37868: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:'

Signature \u7B7E\u540D

\n

\u4ECB\u7ECD

\n

\u7528\u4E8E\u7B7E\u540D\u573A\u666F\u7684\u7EC4\u4EF6\uFF0C\u57FA\u4E8E Canvas \u5B9E\u73B0\u3002\u8BF7\u5347\u7EA7 vant \u5230 >= 4.3.0 \u7248\u672C\u6765\u4F7F\u7528\u8BE5\u7EC4\u4EF6\u3002

\n

\u5F15\u5165

\n

\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003\u7EC4\u4EF6\u6CE8\u518C\u3002

\n
import { createApp } from 'vue';\nimport { Signature } from 'vant';\n\nconst app = createApp();\napp.use(Signature);\n
\n

\u4EE3\u7801\u6F14\u793A

\n

\u57FA\u7840\u7528\u6CD5

\n

\u5F53\u70B9\u51FB\u786E\u8BA4\u6309\u94AE\u65F6\uFF0C\u7EC4\u4EF6\u4F1A\u89E6\u53D1 submit \u4E8B\u4EF6\uFF0C\u4E8B\u4EF6\u7684\u7B2C\u4E00\u4E2A\u53C2\u6570\u4E3A data\uFF0C\u5305\u542B\u4EE5\u4E0B\u5B57\u6BB5\uFF1A

\n\n
<van-signature @submit="onSubmit" @clear="onClear" />\n<van-image v-if="image" :src="image" />\n
\n
import { ref } from 'vue';\nimport { showToast } from 'vant';\n\nexport default {\n  setup() {\n    const image = ref('');\n    const onSubmit = (data) => {\n      image.value = data.image;\n    };\n    const onClear = () => showToast('clear');\n\n    return {\n      image,\n      onSubmit,\n      onClear,\n    };\n  },\n};\n
\n

\u81EA\u5B9A\u4E49\u989C\u8272

\n

\u901A\u8FC7 pen-color \u6765\u81EA\u5B9A\u4E49\u7B14\u89E6\u989C\u8272\u3002

\n
<van-signature pen-color="#ff0000" @submit="onSubmit" @clear="onClear" />\n
\n

\u81EA\u5B9A\u4E49\u7EBF\u5BBD

\n

\u901A\u8FC7 line-width \u6765\u81EA\u5B9A\u4E49\u7EBF\u6761\u5BBD\u5EA6\u3002

\n
<van-signature :line-width="6" @submit="onSubmit" @clear="onClear" />\n
\n

\u81EA\u5B9A\u4E49\u80CC\u666F\u989C\u8272

\n

\u901A\u8FC7 background-color \u6765\u81EA\u5B9A\u4E49\u80CC\u666F\u989C\u8272\u3002

\n
<van-signature background-color="#eee" @submit="onSubmit" @clear="onClear" />\n
\n

API

\n

Props

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53C2\u6570\u8BF4\u660E\u7C7B\u578B\u9ED8\u8BA4\u503C
type\u5BFC\u51FA\u56FE\u7247\u7C7B\u578Bstringpng
pen-color\u7B14\u89E6\u989C\u8272\uFF0C\u9ED8\u8BA4\u9ED1\u8272string#000
line-width\u7EBF\u6761\u5BBD\u5EA6number3
background-color\u80CC\u666F\u989C\u8272string-
tips\u5F53\u4E0D\u652F\u6301 Canvas \u7684\u65F6\u5019\u51FA\u73B0\u7684\u63D0\u793A\u6587\u6848string-
clear-button-text\u6E05\u9664\u6309\u94AE\u6587\u6848string\u6E05\u7A7A
confirm-button-text\u786E\u8BA4\u6309\u94AE\u6587\u6848string\u786E\u8BA4
\n

Events

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u4E8B\u4EF6\u540D\u8BF4\u660E\u56DE\u8C03\u53C2\u6570
start\u5F00\u59CB\u7B7E\u540D\u65F6\u89E6\u53D1-
end\u7ED3\u675F\u7B7E\u540D\u65F6\u89E6\u53D1-
signing\u7B7E\u540D\u8FC7\u7A0B\u4E2D\u89E6\u53D1event: TouchEvent
submit\u70B9\u51FB\u786E\u5B9A\u6309\u94AE\u65F6\u89E6\u53D1data: { image: string; canvas: HTMLCanvasElement }
clear\u70B9\u51FB\u53D6\u6D88\u6309\u94AE\u65F6\u89E6\u53D1-
\n

\u65B9\u6CD5

\n

\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 Signature \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u65B9\u6CD5\u540D\u8BF4\u660E\u53C2\u6570\u8FD4\u56DE\u503C
resize v4.7.3\u5916\u5C42\u5143\u7D20\u5927\u5C0F\u6216\u7EC4\u4EF6\u663E\u793A\u72B6\u6001\u53D8\u5316\u65F6\uFF0C\u53EF\u4EE5\u8C03\u7528\u6B64\u65B9\u6CD5\u6765\u89E6\u53D1\u91CD\u7ED8--
clear v4.8.6\u53EF\u8C03\u7528\u6B64\u65B9\u6CD5\u6765\u6E05\u9664\u7B7E\u540D--
submit v4.8.6\u89E6\u53D1 submit \u4E8B\u4EF6\uFF0C\u4E0E\u70B9\u51FB\u786E\u8BA4\u6309\u94AE\u7684\u6548\u679C\u7B49\u4EF7--
\n

\u7C7B\u578B\u5B9A\u4E49

\n

\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A

\n
import type { SignatureProps, SignatureInstance } from 'vant';\n
\n

SignatureInstance \u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A

\n
import { ref } from 'vue';\nimport type { SignatureInstance } from 'vant';\n\nconst signatureRef = ref<SignatureInstance>();\n\nsignatureRef.value?.resize();\n
\n

\u4E3B\u9898\u5B9A\u5236

\n

\u6837\u5F0F\u53D8\u91CF

\n

\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 ConfigProvider \u7EC4\u4EF6\u3002

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\u540D\u79F0\u9ED8\u8BA4\u503C\u63CF\u8FF0
--van-signature-paddingvar(--van-padding-xs)-
--van-signature-content-height200px\u753B\u5E03\u9AD8\u5EA6
--van-signature-content-backgroundvar(--van-background-2)\u753B\u5E03\u80CC\u666F\u8272
--van-signature-content-border1px dotted #dadada\u753B\u5E03\u8FB9\u6846\u6837\u5F0F
\n
'},null,8,d))}}}]);