/*! 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:'
\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
\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
\nimport { createApp } from 'vue';\nimport { Signature } from 'vant';\n\nconst app = createApp();\napp.use(Signature);\n
\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
image
\uFF1A\u7B7E\u540D\u5BF9\u5E94\u7684\u56FE\u7247\uFF0C\u4E3A base64 \u5B57\u7B26\u4E32\u683C\u5F0F\u3002\u82E5\u7B7E\u540D\u4E3A\u7A7A\uFF0C\u5219\u8FD4\u56DE\u7A7A\u5B57\u7B26\u4E32\u3002canvas
\uFF1ACanvas \u5143\u7D20\u3002<van-signature @submit="onSubmit" @clear="onClear" />\n<van-image v-if="image" :src="image" />\n
\nimport { 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\u901A\u8FC7 pen-color
\u6765\u81EA\u5B9A\u4E49\u7B14\u89E6\u989C\u8272\u3002
<van-signature pen-color="#ff0000" @submit="onSubmit" @clear="onClear" />\n
\n\u901A\u8FC7 line-width
\u6765\u81EA\u5B9A\u4E49\u7EBF\u6761\u5BBD\u5EA6\u3002
<van-signature :line-width="6" @submit="onSubmit" @clear="onClear" />\n
\n\u901A\u8FC7 background-color
\u6765\u81EA\u5B9A\u4E49\u80CC\u666F\u989C\u8272\u3002
<van-signature background-color="#eee" @submit="onSubmit" @clear="onClear" />\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
type | \n\u5BFC\u51FA\u56FE\u7247\u7C7B\u578B | \nstring | \npng | \n
pen-color | \n\u7B14\u89E6\u989C\u8272\uFF0C\u9ED8\u8BA4\u9ED1\u8272 | \nstring | \n#000 | \n
line-width | \n\u7EBF\u6761\u5BBD\u5EA6 | \nnumber | \n3 | \n
background-color | \n\u80CC\u666F\u989C\u8272 | \nstring | \n- | \n
tips | \n\u5F53\u4E0D\u652F\u6301 Canvas \u7684\u65F6\u5019\u51FA\u73B0\u7684\u63D0\u793A\u6587\u6848 | \nstring | \n- | \n
clear-button-text | \n\u6E05\u9664\u6309\u94AE\u6587\u6848 | \nstring | \n\u6E05\u7A7A | \n
confirm-button-text | \n\u786E\u8BA4\u6309\u94AE\u6587\u6848 | \nstring | \n\u786E\u8BA4 | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
start | \n\u5F00\u59CB\u7B7E\u540D\u65F6\u89E6\u53D1 | \n- | \n
end | \n\u7ED3\u675F\u7B7E\u540D\u65F6\u89E6\u53D1 | \n- | \n
signing | \n\u7B7E\u540D\u8FC7\u7A0B\u4E2D\u89E6\u53D1 | \nevent: TouchEvent | \n
submit | \n\u70B9\u51FB\u786E\u5B9A\u6309\u94AE\u65F6\u89E6\u53D1 | \ndata: { image: string; canvas: HTMLCanvasElement } | \n
clear | \n\u70B9\u51FB\u53D6\u6D88\u6309\u94AE\u65F6\u89E6\u53D1 | \n- | \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\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
resize v4.7.3 | \n\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 | \n- | \n- | \n
clear v4.8.6 | \n\u53EF\u8C03\u7528\u6B64\u65B9\u6CD5\u6765\u6E05\u9664\u7B7E\u540D | \n- | \n- | \n
submit v4.8.6 | \n\u89E6\u53D1 submit \u4E8B\u4EF6\uFF0C\u4E0E\u70B9\u51FB\u786E\u8BA4\u6309\u94AE\u7684\u6548\u679C\u7B49\u4EF7 | \n- | \n- | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type { SignatureProps, SignatureInstance } from 'vant';\n
\nSignatureInstance
\u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A
import { ref } from 'vue';\nimport type { SignatureInstance } from 'vant';\n\nconst signatureRef = ref<SignatureInstance>();\n\nsignatureRef.value?.resize();\n
\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\u540D\u79F0 | \n\u9ED8\u8BA4\u503C | \n\u63CF\u8FF0 | \n
---|---|---|
--van-signature-padding | \nvar(--van-padding-xs) | \n- | \n
--van-signature-content-height | \n200px | \n\u753B\u5E03\u9AD8\u5EA6 | \n
--van-signature-content-background | \nvar(--van-background-2) | \n\u753B\u5E03\u80CC\u666F\u8272 | \n
--van-signature-content-border | \n1px dotted #dadada | \n\u753B\u5E03\u8FB9\u6846\u6837\u5F0F | \n