/*! For license information please see 9603.e16927f4.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["9603"],{67927:function(s,a,n){"use strict";n.r(a);var e=n("80681");let l=["innerHTML"];a.default={setup:()=>({html:""}),render:()=>((0,e.wg)(),(0,e.iD)("div",{class:"van-doc-markdown-body",innerHTML:'

\u4ECE v3 \u5347\u7EA7\u5230 v4

\n

\u4ECB\u7ECD

\n

\u672C\u6587\u6863\u63D0\u4F9B\u4E86\u4ECE Vant 3 \u5230 Vant 4 \u7684\u5347\u7EA7\u6307\u5357\u3002

\n

\u5B89\u88C5 Vant 4

\n

\u9996\u5148\u4F60\u9700\u8981\u5B89\u88C5 Vant 4 \u4EE5\u53CA @vant/compat\u3002

\n

@vant/compat \u662F\u4E00\u4E2A\u517C\u5BB9\u5305\uFF0C\u53EF\u4EE5\u5E2E\u52A9\u4F60\u4ECE Vant 3 \u8FC7\u6E21\u5230 Vant 4\u3002

\n
# \u901A\u8FC7 npm \u5B89\u88C5\nnpm add vant@^4 @vant/compat@^1\n\n# \u901A\u8FC7 yarn \u5B89\u88C5\nyarn add vant@^4 @vant/compat@^1\n\n# \u901A\u8FC7 pnpm \u5B89\u88C5\npnpm add vant@^4 @vant/compat@^1\n\n# \u901A\u8FC7 Bun \u5B89\u88C5\nbun add vant@^4 @vant/compat@^1\n
\n

\u4F60\u4E5F\u53EF\u4EE5\u76F4\u63A5\u4FEE\u6539 package.json \u7684 dependencies \u5B57\u6BB5\u4E2D\u7684\u7248\u672C\u53F7\uFF0C\u4FEE\u6539\u5B8C\u6210\u540E\u9700\u8981\u91CD\u65B0\u5B89\u88C5\u4F9D\u8D56\u3002

\n
{\n  "dependencies": {\n-    "vant": "^3.0.0",\n+    "vant": "^4.0.0",\n+    "@vant/compat": "^1.0.0",\n  }\n}\n
\n

\u8C03\u6574\u6309\u9700\u5F15\u5165\u65B9\u5F0F

\n

\u79FB\u9664 babel-plugin-import

\n

\u4ECE Vant 4.0 \u5F00\u59CB\uFF0C\u5C06\u4E0D\u518D\u652F\u6301 babel-plugin-import\uFF0C\u8BF7\u79FB\u9664\u9879\u76EE\u4E2D\u4F9D\u8D56\u7684 babel-plugin-import \u63D2\u4EF6\u3002

\n

\u53EA\u9700\u8981\u5220\u9664 babel.config.js \u4E2D\u7684\u4EE5\u4E0B\u4EE3\u7801\u5373\u53EF\uFF1A

\n
module.exports = {\n  plugins: [\n-    ['import', {\n-      libraryName: 'vant',\n-      libraryDirectory: 'es',\n-      style: true\n-    }, 'vant']\n  ]\n};\n
\n

\u6536\u76CA

\n

\u79FB\u9664 babel-plugin-import \u4E3B\u8981\u5E26\u6765\u4EE5\u4E0B\u6536\u76CA\uFF1A

\n\n
import { showToast, buttonProps } from 'vant';\n
\n

\u6837\u5F0F\u5F15\u5165\u65B9\u6848

\n

\u79FB\u9664 babel-plugin-import \u5BF9\u9879\u76EE\u7684 JS \u4F53\u79EF\u4E0D\u4F1A\u6709\u5F71\u54CD\uFF0C\u56E0\u4E3A Vant \u9ED8\u8BA4\u652F\u6301\u901A\u8FC7 Tree Shaking \u6765\u79FB\u9664\u4E0D\u9700\u8981\u7684 JS \u4EE3\u7801\u3002

\n

\u800C CSS \u4EE3\u7801\u7684\u5F15\u5165\u65B9\u5F0F\u53EF\u4EE5\u4ECE\u4EE5\u4E0B\u4E24\u79CD\u65B9\u5F0F\u4E2D\u8FDB\u884C\u9009\u62E9\uFF1A

\n\n
import 'vant/lib/index.css';\n
\n\n

\u7EC4\u4EF6\u91CD\u6784

\n

\u4ECB\u7ECD

\n

\u5728 Vant 4 \u4E2D\uFF0C\u4E00\u5171\u6709\u4E09\u4E2A\u7EC4\u4EF6\u88AB\u5B8C\u5168\u91CD\u6784\uFF0C\u5B83\u4EEC\u662F\uFF1A

\n\n

\u8FD9\u4E09\u4E2A\u7EC4\u4EF6\u4E4B\u6240\u4EE5\u88AB\u91CD\u6784\uFF0C\u662F\u56E0\u4E3A\u5728\u4E4B\u524D\u7684\u7248\u672C\u4E2D\uFF0CPicker \u7EC4\u4EF6\u7684 API \u8BBE\u8BA1\u5B58\u5728\u4E00\u4E9B\u4E0D\u5408\u7406\u7684\u8BBE\u8BA1\uFF0C\u5BFC\u81F4\u5927\u5BB6\u5728\u4F7F\u7528\u65F6\u7ECF\u5E38\u9047\u5230\u95EE\u9898\uFF0C\u6BD4\u5982\uFF1A

\n\n

\u4E3A\u4E86\u89E3\u51B3\u4E0A\u8FF0\u95EE\u9898\uFF0C\u6211\u4EEC\u5728 v4 \u7248\u672C\u4E2D\u5BF9 Picker \u7EC4\u4EF6\u8FDB\u884C\u4E86\u91CD\u6784\uFF0C\u540C\u65F6\u4E5F\u91CD\u6784\u4E86\u57FA\u4E8E Picker \u6D3E\u751F\u51FA\u7684 Area \u548C DatetimePicker \u7EC4\u4EF6\u3002\u5982\u679C\u4F60\u7684\u9879\u76EE\u4E2D\u4F7F\u7528\u4E86\u8FD9\u4E09\u4E2A\u7EC4\u4EF6\uFF0C\u8BF7\u4ED4\u7EC6\u9605\u8BFB\u6587\u6863\u5E76\u8FDB\u884C\u5347\u7EA7\u3002

\n

Picker \u7EC4\u4EF6\u91CD\u6784

\n

\u4E3B\u8981\u53D8\u66F4

\n\n
\n

\u8BE6\u7EC6\u7528\u6CD5\u8BF7\u53C2\u89C1 Picker \u7EC4\u4EF6\u6587\u6863\u3002

\n
\n

DatetimePicker \u7EC4\u4EF6\u91CD\u6784

\n

DatetimePicker \u7EC4\u4EF6\u88AB\u62C6\u5206\u4E3A\u4E09\u4E2A\u5B50\u7EC4\u4EF6\uFF1A

\n\n

\u540C\u65F6\uFF0CTimePicker \u548C DatePicker \u7EC4\u4EF6\u4E5F\u57FA\u4E8E\u65B0\u7248 Picker \u7EC4\u4EF6\u8FDB\u884C\u91CD\u6784\uFF0C\u5E76\u4F18\u5316\u4E86\u90E8\u5206 API \u8BBE\u8BA1\u3002

\n

\u4E3B\u8981\u53D8\u66F4

\n

\u4EE5\u4E0B\u662F TimePicker \u548C DatePicker \u7684\u4E3B\u8981 API \u53D8\u5316\uFF0C\u66F4\u591A\u7EC6\u8282\u8BF7\u53C2\u8003 TimePicker \u548C DatePicker \u6587\u6863\u3002

\n\n
\n

Vant 4 \u4E0D\u518D\u63D0\u4F9B\u65E7\u7248\u7684 DatetimePicker \u7EC4\u4EF6\uFF0C\u4F7F\u7528 PickerGroup \u7EC4\u4EF6\u53EF\u4EE5\u5B9E\u73B0\u66F4\u7075\u6D3B\u3001\u66F4\u4E30\u5BCC\u7684\u4EA4\u4E92\u6548\u679C\uFF0C\u5177\u4F53\u7528\u6CD5\u8BF7\u53C2\u8003 PickerGroup \u7EC4\u4EF6\u6587\u6863\u3002

\n
\n

Area \u7EC4\u4EF6\u91CD\u6784

\n

Area \u7EC4\u4EF6\u662F\u57FA\u4E8E Picker \u7EC4\u4EF6\u8FDB\u884C\u5C01\u88C5\u7684\uFF0C\u56E0\u6B64\u672C\u6B21\u5347\u7EA7\u4E5F\u5BF9 Area \u7EC4\u4EF6\u8FDB\u884C\u4E86\u5185\u90E8\u903B\u8F91\u7684\u91CD\u6784\uFF0C\u5E76\u4F18\u5316\u4E86\u90E8\u5206 API\u3002

\n

\u4E3B\u8981\u53D8\u66F4

\n\n
\n

\u8BE6\u7EC6\u7528\u6CD5\u8BF7\u53C2\u89C1 Area \u7EC4\u4EF6\u6587\u6863\u3002

\n
\n

API \u8C03\u6574

\n

Dialog \u8C03\u7528\u65B9\u5F0F\u8C03\u6574

\n

\u5728 Vant 3 \u4E2D\uFF0CDialog \u662F\u4E00\u4E2A\u51FD\u6570\uFF0C\u8C03\u7528\u51FD\u6570\u53EF\u4EE5\u5FEB\u901F\u5524\u8D77\u5168\u5C40\u7684\u5F39\u7A97\u7EC4\u4EF6\uFF0C\u800C Dialog.Component \u624D\u662F Dialog \u7EC4\u4EF6\u5BF9\u8C61\uFF0C\u8FD9\u4E0E\u5927\u90E8\u5206\u7EC4\u4EF6\u7684\u7528\u6CD5\u5B58\u5728\u5DEE\u5F02\uFF0C\u5BB9\u6613\u5BFC\u81F4\u4F7F\u7528\u9519\u8BEF\u3002

\n

\u4E3A\u4E86\u66F4\u7B26\u5408\u76F4\u89C9\uFF0C\u6211\u4EEC\u5728 Vant 4 \u4E2D\u8C03\u6574\u4E86 Dialog \u7684\u8C03\u7528\u65B9\u5F0F\uFF0C\u5C06 Dialog() \u51FD\u6570\u91CD\u547D\u540D\u4E3A showDialog()\uFF0C\u5E76\u8BA9 Dialog \u76F4\u63A5\u6307\u5411\u7EC4\u4EF6\u5BF9\u8C61\u3002

\n
// Vant 3\nDialog(); // \u51FD\u6570\u8C03\u7528\nDialog.Component; // \u7EC4\u4EF6\u5BF9\u8C61\n\n// Vant 4\nshowDialog(); // \u51FD\u6570\u8C03\u7528\nDialog; // \u7EC4\u4EF6\u5BF9\u8C61\n
\n

\u7531\u4E8E Dialog \u53D8\u4E3A\u4E86\u7EC4\u4EF6\u5BF9\u8C61\uFF0CDialog \u4E0A\u6302\u8F7D\u7684\u5176\u4ED6\u65B9\u6CD5\u4E5F\u8FDB\u884C\u4E86\u91CD\u547D\u540D\uFF0C\u65B0\u65E7 API \u7684\u6620\u5C04\u5173\u7CFB\u5982\u4E0B\uFF1A

\n
Dialog(); // -> showDialog()\nDialog.alert(); // -> showDialog()\nDialog.confirm(); // -> showConfirmDialog()\nDialog.close(); // -> closeDialog();\nDialog.setDefaultOptions(); // -> setDialogDefaultOptions()\nDialog.resetDefaultOptions(); // -> resetDialogDefaultOptions()\n
\n

\u517C\u5BB9\u65B9\u6848

\n

\u4E3A\u4E86\u4FBF\u4E8E\u65E7\u7248\u672C\u4EE3\u7801\u8FC1\u79FB\u81F3 v4\uFF0C\u6211\u4EEC\u63D0\u4F9B\u4E86\u517C\u5BB9\u65B9\u6848\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 @vant/compat \u4E2D\u5BFC\u51FA\u7684 Dialog \u5BF9\u8C61\u6765\u517C\u5BB9\u539F\u6709\u4EE3\u7801\u3002

\n

\u4ECE @vant/compat \u4E2D\u5F15\u7528 Dialog \u65B9\u6CD5\uFF1A

\n
import { Dialog } from '@vant/compat';\n\nDialog();\nDialog.close();\n
\n

@vant/compat \u4E2D\u5BFC\u51FA\u7684 Dialog \u4E0E Vant 3 \u4E2D\u7684 Dialog \u62E5\u6709\u5B8C\u5168\u4E00\u81F4\u7684 API \u548C\u884C\u4E3A\uFF0C\u56E0\u6B64\u4F60\u53EA\u9700\u8981\u4FEE\u6539 Dialog \u7684\u5F15\u7528\u8DEF\u5F84\uFF0C\u5176\u4ED6\u4EE3\u7801\u53EF\u4EE5\u4FDD\u6301\u4E0D\u53D8\u3002

\n

\u5728\u9879\u76EE\u5B8C\u6210\u5347\u7EA7\u5230 Vant v4 \u540E\uFF0C\u5EFA\u8BAE\u5728\u8FED\u4EE3\u4E2D\u9010\u6B65\u66FF\u6362\u4E3A\u65B0\u7684 showDialog \u7B49\u65B9\u6CD5\uFF0C\u5E76\u79FB\u9664 @vant/compat \u5305\u3002

\n

Toast \u8C03\u7528\u65B9\u5F0F\u8C03\u6574

\n

Vant 4 \u4E2D\uFF0CToast \u7EC4\u4EF6\u7684\u8C03\u7528\u65B9\u5F0F\u4E5F\u8FDB\u884C\u4E86\u8C03\u6574\uFF0C\u4E0E Dialog \u7EC4\u4EF6\u7684\u6539\u52A8\u4E00\u81F4\uFF1A

\n
// Vant 3\nToast(); // \u51FD\u6570\u8C03\u7528\n\n// Vant 4\nshowToast(); // \u51FD\u6570\u8C03\u7528\nToast; // \u7EC4\u4EF6\u5BF9\u8C61\n
\n

Toast \u4E0A\u6302\u8F7D\u7684\u5176\u4ED6\u65B9\u6CD5\u4E5F\u8FDB\u884C\u4E86\u91CD\u547D\u540D\uFF0C\u65B0\u65E7 API \u7684\u6620\u5C04\u5173\u7CFB\u5982\u4E0B\uFF1A

\n
Toast(); // -> showToast()\nToast.fail(); // -> showFailToast()\nToast.success(); // -> showSuccessToast()\nToast.loading(); // -> showLoadingToast()\nToast.clear(); // -> closeToast()\nToast.setDefaultOptions(); // -> setToastDefaultOptions()\nToast.resetDefaultOptions(); // -> resetToastDefaultOptions()\n
\n

\u540C\u65F6\uFF0CVant 4 \u5C06\u4E0D\u518D\u5728 this \u5BF9\u8C61\u4E0A\u5168\u5C40\u6CE8\u518C $toast \u65B9\u6CD5\uFF0C\u8FD9\u610F\u5473\u7740 this \u5BF9\u8C61\u4E0A\u5C06\u65E0\u6CD5\u8BBF\u95EE\u5230 $toast\u3002

\n

\u517C\u5BB9\u65B9\u6848

\n

\u4E3A\u4E86\u4FBF\u4E8E\u4EE3\u7801\u8FC1\u79FB\uFF0C\u6211\u4EEC\u63D0\u4F9B\u4E86\u517C\u5BB9\u65B9\u6848\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 @vant/compat \u4E2D\u5BFC\u51FA\u7684 Toast \u5BF9\u8C61\u6765\u517C\u5BB9\u539F\u6709\u4EE3\u7801\u3002

\n
import { Toast } from '@vant/compat';\n\nToast();\nToast.clear();\n
\n

@vant/compat \u4E2D\u5BFC\u51FA\u7684 Toast \u4E0E Vant 3 \u4E2D\u7684 Toast \u62E5\u6709\u5B8C\u5168\u4E00\u81F4\u7684 API \u548C\u884C\u4E3A\uFF0C\u56E0\u6B64\u4F60\u53EA\u9700\u8981\u4FEE\u6539 Toast \u7684\u5F15\u7528\u8DEF\u5F84\uFF0C\u5176\u4ED6\u4EE3\u7801\u53EF\u4EE5\u4FDD\u6301\u4E0D\u53D8\u3002

\n

Notify \u8C03\u7528\u65B9\u5F0F\u8C03\u6574

\n

Vant 4 \u4E2D\uFF0CNotify \u7EC4\u4EF6\u7684\u8C03\u7528\u65B9\u5F0F\u4E5F\u8FDB\u884C\u4E86\u8C03\u6574\uFF0C\u4E0E Dialog \u7EC4\u4EF6\u7684\u6539\u52A8\u4E00\u81F4\uFF1A

\n
// Vant 3\nNotify(); // \u51FD\u6570\u8C03\u7528\nNotify.Component; // \u7EC4\u4EF6\u5BF9\u8C61\n\n// Vant 4\nshowNotify(); // \u51FD\u6570\u8C03\u7528\nNotify; // \u7EC4\u4EF6\u5BF9\u8C61\n
\n

Notify \u4E0A\u6302\u8F7D\u7684\u5176\u4ED6\u65B9\u6CD5\u4E5F\u8FDB\u884C\u4E86\u91CD\u547D\u540D\uFF0C\u65B0\u65E7 API \u7684\u6620\u5C04\u5173\u7CFB\u5982\u4E0B\uFF1A

\n
Notify(); // -> showNotify()\nNotify.clear(); // -> closeNotify()\nNotify.setDefaultOptions(); // -> setNotifyDefaultOptions()\nNotify.resetDefaultOptions(); // -> resetNotifyDefaultOptions()\n
\n

\u540C\u65F6\uFF0CVant 4 \u5C06\u4E0D\u518D\u5728 this \u5BF9\u8C61\u4E0A\u5168\u5C40\u6CE8\u518C $notify \u65B9\u6CD5\uFF0C\u8FD9\u610F\u5473\u7740 this \u5BF9\u8C61\u4E0A\u5C06\u65E0\u6CD5\u8BBF\u95EE\u5230 $notify\u3002

\n

\u517C\u5BB9\u65B9\u6848

\n

\u4E3A\u4E86\u4FBF\u4E8E\u4EE3\u7801\u8FC1\u79FB\uFF0C\u6211\u4EEC\u63D0\u4F9B\u4E86\u517C\u5BB9\u65B9\u6848\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 @vant/compat \u4E2D\u5BFC\u51FA\u7684 Notify \u5BF9\u8C61\u6765\u517C\u5BB9\u539F\u6709\u4EE3\u7801\u3002

\n
import { Notify } from '@vant/compat';\n\nNotify();\nNotify.clear();\n
\n

@vant/compat \u4E2D\u5BFC\u51FA\u7684 Notify \u4E0E Vant 3 \u4E2D\u7684 Notify \u62E5\u6709\u5B8C\u5168\u4E00\u81F4\u7684 API \u548C\u884C\u4E3A\uFF0C\u56E0\u6B64\u4F60\u53EA\u9700\u8981\u4FEE\u6539 Notify \u7684\u5F15\u7528\u8DEF\u5F84\uFF0C\u5176\u4ED6\u4EE3\u7801\u53EF\u4EE5\u4FDD\u6301\u4E0D\u53D8\u3002

\n

ImagePreview \u8C03\u7528\u65B9\u5F0F\u8C03\u6574

\n

Vant 4 \u4E2D\uFF0CImagePreview \u7EC4\u4EF6\u7684\u8C03\u7528\u65B9\u5F0F\u4E5F\u8FDB\u884C\u4E86\u8C03\u6574\uFF0C\u4E0E Dialog \u7EC4\u4EF6\u7684\u6539\u52A8\u4E00\u81F4\uFF1A

\n
// Vant 3\nImagePreview(); // \u51FD\u6570\u8C03\u7528\nImagePreview.Component; // \u7EC4\u4EF6\u5BF9\u8C61\n\n// Vant 4\nshowImagePreview(); // \u51FD\u6570\u8C03\u7528\nImagePreview; // \u7EC4\u4EF6\u5BF9\u8C61\n
\n

\u517C\u5BB9\u65B9\u6848

\n

\u4E3A\u4E86\u4FBF\u4E8E\u4EE3\u7801\u8FC1\u79FB\uFF0C\u6211\u4EEC\u63D0\u4F9B\u4E86\u517C\u5BB9\u65B9\u6848\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528 @vant/compat \u4E2D\u5BFC\u51FA\u7684 ImagePreview \u5BF9\u8C61\u6765\u517C\u5BB9\u539F\u6709\u4EE3\u7801\u3002

\n
import { ImagePreview } from '@vant/compat';\n\nImagePreview();\n
\n

@vant/compat \u4E2D\u5BFC\u51FA\u7684 ImagePreview \u4E0E Vant 3 \u4E2D\u7684 ImagePreview \u62E5\u6709\u5B8C\u5168\u4E00\u81F4\u7684 API \u548C\u884C\u4E3A\uFF0C\u56E0\u6B64\u4F60\u53EA\u9700\u8981\u4FEE\u6539 ImagePreview \u7684\u5F15\u7528\u8DEF\u5F84\uFF0C\u5176\u4ED6\u4EE3\u7801\u53EF\u4EE5\u4FDD\u6301\u4E0D\u53D8\u3002

\n

\u4E8B\u4EF6\u547D\u540D\u8C03\u6574

\n

\u4ECE Vant 4 \u5F00\u59CB\uFF0C\u6240\u6709\u7684\u4E8B\u4EF6\u5747\u91C7\u7528 Vue \u5B98\u65B9\u63A8\u8350\u7684\u9A7C\u5CF0\u683C\u5F0F\u8FDB\u884C\u547D\u540D\u3002

\n
// Vant 3\nemit('click-input');\n\n// Vant 4\nemit('clickInput');\n
\n

\u8FD9\u9879\u6539\u52A8\u4E0D\u5F71\u54CD\u539F\u6709\u7684\u6A21\u677F\u4EE3\u7801\uFF0CVue \u4F1A\u81EA\u52A8\u5728\u6A21\u677F\u4E2D\u5BF9\u4E8B\u4EF6\u540D\u8FDB\u884C\u683C\u5F0F\u8F6C\u6362\uFF0C\u56E0\u6B64\u4F60\u65E0\u987B\u505A\u4EFB\u4F55\u66F4\u6539\u3002

\n
<!-- \u4EE5\u4E0B\u4EE3\u7801\u53EF\u4EE5\u7167\u5E38\u8FD0\u884C\uFF0C\u65E0\u987B\u505A\u4EFB\u4F55\u66F4\u6539 -->\n<van-field @click-input="onClick" />\n
\n

\u5982\u679C\u4F60\u5728 JSX \u4E2D\u4F7F\u7528 Vant \u7EC4\u4EF6\uFF0C\u9700\u8981\u5C06\u76D1\u542C\u7684\u4E8B\u4EF6\u540D\u8C03\u6574\u4E3A\u9A7C\u5CF0\u683C\u5F0F\uFF0C\u539F\u6709\u7684\u4E2D\u5212\u7EBF\u683C\u5F0F\u5C06\u4E0D\u518D\u751F\u6548\uFF0C\u65B0\u7684\u76D1\u542C\u65B9\u5F0F\u66F4\u52A0\u7B26\u5408 JSX \u672C\u8EAB\u7684\u89C4\u8303\uFF1A

\n
// Vant 3\n<Field onClick-input={onClick} />\n\n// Vant 4\n<Field onClickInput={onClick} />\n
\n

\u5176\u4ED6 API \u8C03\u6574

\n

\u5728 Vant 4.0 \u7248\u672C\u4E2D\uFF0C\u4EE5\u4E0B API \u8FDB\u884C\u4E86\u4E0D\u517C\u5BB9\u66F4\u65B0\uFF1A

\n

AddressEdit

\n\n\n

Popup \u7684 CSS \u6837\u5F0F\u8FDB\u884C\u4E86\u4E00\u5B9A\u8C03\u6574\uFF0C\u5982\u679C\u4F60\u5728 Popup \u7EC4\u4EF6\u4E0A\u6DFB\u52A0\u4E86\u4E00\u4E9B\u81EA\u5B9A\u4E49\u7684 CSS \u6837\u5F0F\uFF0C\u8BF7\u786E\u8BA4\u672C\u6B21\u5347\u7EA7\u662F\u5426\u5BF9\u9879\u76EE\u4E2D\u7684 UI \u4EA7\u751F\u5F71\u54CD\u3002

\n\n
// Vant 3\n.van-popup--center {\n  left: 50%;\n  transform: translate3d(-50%, -50%, 0);\n}\n\n// Vant 4\n.van-popup--center {\n  left: 0;\n  right: 0;\n  width: fit-content;\n  max-width: calc(100vw - var(--van-padding-md) * 2);\n  margin: 0 auto;\n  transform: translateY(-50%);\n}\n
\n

Tabs

\n\n

\u6837\u5F0F\u8C03\u6574

\n

\u4E3B\u8272\u8C03\u7EDF\u4E00

\n

\u5728\u4E4B\u524D\u7684\u7248\u672C\u4E2D\uFF0CVant \u7EC4\u4EF6\u6709\u4E24\u79CD\u4E3B\u8272\u8C03\uFF0C\u90E8\u5206\u7EC4\u4EF6\u91C7\u7528\u84DD\u8272\uFF08#1989fa\uFF09\u4F5C\u4E3A\u4E3B\u8272\u8C03\uFF0C\u53E6\u4E00\u90E8\u5206\u5219\u91C7\u7528\u7EA2\u8272\uFF08#ee0a24\uFF09\u3002

\n

\u4E3A\u4E86\u4FDD\u6301\u8272\u5F69\u89C4\u8303\u7684\u4E00\u81F4\u6027\uFF0C\u6211\u4EEC\u5728 Vant 4 \u4E2D\u5BF9\u4E3B\u8272\u8C03\u8FDB\u884C\u7EDF\u4E00\uFF0C\u6240\u6709\u7EC4\u4EF6\u5747\u91C7\u7528\u84DD\u8272\u4F5C\u4E3A\u4E3B\u8272\u8C03\u3002

\n

\u4EE5\u4E0B\u7EC4\u4EF6\u7684\u4E3B\u8272\u8C03\u7531\u7EA2\u8272\u8C03\u6574\u4E3A\u84DD\u8272\uFF1A

\n\n

\u79FB\u9664 Less \u53D8\u91CF

\n

\u76EE\u524D Vant \u5DF2\u7ECF\u652F\u6301\u4E86\u57FA\u4E8E CSS \u53D8\u91CF\u7684\u4E3B\u9898\u5B9A\u5236\u80FD\u529B\uFF0C\u76F8\u8F83\u4E8E Less \u5B9A\u5236\u66F4\u52A0\u7075\u6D3B\u3002\u56E0\u6B64\uFF0CVant 4 \u5C06\u4E0D\u518D\u63D0\u4F9B\u57FA\u4E8E Less \u7684\u4E3B\u9898\u5B9A\u5236\u65B9\u5F0F\u3002

\n

\u8FD9\u610F\u5473\u7740 Vant \u7684 npm \u5305\u4E2D\u5C06\u4E0D\u518D\u4F1A\u5305\u542B .less \u6837\u5F0F\u6E90\u6587\u4EF6\uFF0C\u53EA\u4F1A\u63D0\u4F9B\u7F16\u8BD1\u540E\u7684 .css \u6837\u5F0F\u6587\u4EF6\u3002

\n

\u5982\u679C\u4F60\u7684\u9879\u76EE\u6B63\u5728\u4F7F\u7528\u65E7\u7248\u7684 Less \u4E3B\u9898\u5B9A\u5236\uFF0C\u8BF7\u4F7F\u7528 ConfigProvider \u5168\u5C40\u914D\u7F6E \u7EC4\u4EF6\u8FDB\u884C\u66FF\u6362\u3002

\n

\u7B80\u5316 CSS \u53D8\u91CF\u540D

\n

\u8003\u8651\u5230 \u4EE3\u7801\u4F53\u79EF \u548C \u4F7F\u7528\u4FBF\u6377\u6027\uFF0C\u6211\u4EEC\u5BF9\u90E8\u5206 CSS \u53D8\u91CF\u7684\u540D\u79F0\u8FDB\u884C\u4E86\u7B80\u5316\uFF0C\u5728\u53D8\u91CF\u540D\u4E2D\u4F7F\u7528\u4E86\u66F4\u7B80\u77ED\u7684\u5355\u8BCD\uFF0C\u4EE5\u51CF\u5C0F\u4EE3\u7801\u4F53\u79EF\u3002

\n

\u672C\u6B21\u5347\u7EA7\u6D89\u53CA\u4EE5\u4E0B\u53D8\u91CF\u540D\u53D8\u66F4\uFF1A

\n
animation-duration               ->  duration\nanimation-timing-function-enter  ->  ease-out\nanimation-timing-function-leave  ->  ease-in\nbackground-color                 ->  background\nbackground-color-light           ->  background-2\nborder-radius                    ->  radius\nborder-width-base                ->  border-width\nbox-shadow                       ->  shadow\nfont-family                      ->  font\nfont-weight-bold                 ->  font-bold\nprice-integer-font               ->  price-font\ntext-link                        ->  link\ntransition-duration              ->  duration\n
\n

\u7531\u4E8E\u6D89\u53CA\u7684 CSS \u53D8\u91CF\u8F83\u591A\uFF0C\u5EFA\u8BAE\u5728\u4EE3\u7801\u4ED3\u5E93\u4E2D\u8FDB\u884C\u5168\u5C40\u5339\u914D\u548C\u66FF\u6362\u3002

\n

\u5BF9\u4E8E ConfigProvider \u7EC4\u4EF6\uFF0C\u6211\u4EEC\u65B0\u589E\u4E86 ConfigProviderThemeVars \u7C7B\u578B\u5B9A\u4E49\uFF0C\u63D0\u4F9B\u5B8C\u6574\u7684\u7C7B\u578B\u63D0\u793A\u3002\u5728 TypeScript \u4EE3\u7801\u4E2D\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7\u7C7B\u578B\u63D0\u793A\u6765\u786E\u4FDD\u4E3B\u9898\u53D8\u91CF\u88AB\u6B63\u786E\u66FF\u6362\u3002

\n
import type { ConfigProviderThemeVars } from 'vant';\n\nconst themeVars: ConfigProviderThemeVars = {\n  sliderBarHeight: '4px',\n};\n
\n
'},null,8,l))}}}]);