/*! For license information please see 1021.0572424d.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["1021"],{63590:function(n,s,t){"use strict";t.r(s);var a=t("80681");let d=["innerHTML"];s.default={setup:()=>({html:""}),render:()=>((0,a.wg)(),(0,a.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
\u5728\u9875\u9762\u9876\u90E8\u5C55\u793A\u6D88\u606F\u63D0\u793A\uFF0C\u652F\u6301\u7EC4\u4EF6\u8C03\u7528\u548C\u51FD\u6570\u8C03\u7528\u4E24\u79CD\u65B9\u5F0F\u3002
\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
\nimport { createApp } from 'vue';\nimport { Notify } from 'vant';\n\nconst app = createApp();\napp.use(Notify);\n
\n\u4E3A\u4E86\u4FBF\u4E8E\u4F7F\u7528 Notify
\uFF0CVant \u63D0\u4F9B\u4E86\u4E00\u7CFB\u5217\u8F85\u52A9\u51FD\u6570\uFF0C\u901A\u8FC7\u8F85\u52A9\u51FD\u6570\u53EF\u4EE5\u5FEB\u901F\u5524\u8D77\u5168\u5C40\u7684\u6D88\u606F\u63D0\u793A\u3002
\u6BD4\u5982\u4F7F\u7528 showNotify
\u51FD\u6570\uFF0C\u8C03\u7528\u540E\u4F1A\u76F4\u63A5\u5728\u9875\u9762\u4E2D\u6E32\u67D3\u5BF9\u5E94\u7684\u63D0\u793A\u3002
import { showNotify } from 'vant';\n\nshowNotify({ message: '\u63D0\u793A' });\n
\nimport { showNotify, closeNotify } from 'vant';\n\n// 3 \u79D2\u540E\u81EA\u52A8\u5173\u95ED\nshowNotify('\u901A\u77E5\u5185\u5BB9');\n\n// \u4E3B\u52A8\u5173\u95ED\ncloseNotify();\n
\n\u652F\u6301 primary
\u3001success
\u3001warning
\u3001danger
\u56DB\u79CD\u901A\u77E5\u7C7B\u578B\uFF0C\u9ED8\u8BA4\u4E3A danger
\u3002
import { showNotify } from 'vant';\n\n// \u4E3B\u8981\u901A\u77E5\nshowNotify({ type: 'primary', message: '\u901A\u77E5\u5185\u5BB9' });\n\n// \u6210\u529F\u901A\u77E5\nshowNotify({ type: 'success', message: '\u901A\u77E5\u5185\u5BB9' });\n\n// \u5371\u9669\u901A\u77E5\nshowNotify({ type: 'danger', message: '\u901A\u77E5\u5185\u5BB9' });\n\n// \u8B66\u544A\u901A\u77E5\nshowNotify({ type: 'warning', message: '\u901A\u77E5\u5185\u5BB9' });\n
\n\u81EA\u5B9A\u4E49\u6D88\u606F\u901A\u77E5\u7684\u989C\u8272\u3001\u4F4D\u7F6E\u548C\u5C55\u793A\u65F6\u957F\u3002
\nimport { showNotify } from 'vant';\n\nshowNotify({\n message: '\u81EA\u5B9A\u4E49\u989C\u8272',\n color: '#ad0000',\n background: '#ffe1e1',\n});\n\nshowNotify({\n message: '\u81EA\u5B9A\u4E49\u4F4D\u7F6E',\n position: 'bottom',\n});\n\nshowNotify({\n message: '\u81EA\u5B9A\u4E49\u65F6\u957F',\n duration: 1000,\n});\n
\n\u5982\u679C\u9700\u8981\u5728 Notify \u5185\u5D4C\u5165\u7EC4\u4EF6\u6216\u5176\u4ED6\u81EA\u5B9A\u4E49\u5185\u5BB9\uFF0C\u53EF\u4EE5\u76F4\u63A5\u4F7F\u7528 Notify \u7EC4\u4EF6\uFF0C\u5E76\u4F7F\u7528\u9ED8\u8BA4\u63D2\u69FD\u8FDB\u884C\u5B9A\u5236\u3002\u4F7F\u7528\u524D\u9700\u8981\u901A\u8FC7 app.use
\u7B49\u65B9\u5F0F\u6CE8\u518C\u7EC4\u4EF6\u3002
<van-button type="primary" text="\u7EC4\u4EF6\u8C03\u7528" @click="showNotify" />\n<van-notify v-model:show="show" type="success">\n <van-icon name="bell" style="margin-right: 4px;" />\n <span>\u901A\u77E5\u5185\u5BB9</span>\n</van-notify>\n
\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const show = ref(false);\n\n const showNotify = () => {\n show.value = true;\n setTimeout(() => {\n show.value = false;\n }, 2000);\n };\n\n return {\n show,\n showNotify,\n };\n },\n};\n
\nVant \u4E2D\u5BFC\u51FA\u4E86\u4EE5\u4E0B Notify \u76F8\u5173\u7684\u8F85\u52A9\u51FD\u6570\uFF1A
\n\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
showNotify | \n\u5728\u9875\u9762\u9876\u90E8\u5C55\u793A Notify | \nNotifyOptions | string | \nnotify \u5B9E\u4F8B | \n
closeNotify | \n\u5173\u95ED\u5F53\u524D\u5C55\u793A\u7684 Notify | \n- | \nvoid | \n
setNotifyDefaultOptions | \n\u4FEE\u6539\u9ED8\u8BA4\u914D\u7F6E\uFF0C\u5F71\u54CD\u6240\u6709\u7684 showNotify \u8C03\u7528 | \nNotifyOptions | \nvoid | \n
resetNotifyDefaultOptions | \n\u91CD\u7F6E\u9ED8\u8BA4\u914D\u7F6E\uFF0C\u5F71\u54CD\u6240\u6709\u7684 showNotify \u8C03\u7528 | \n- | \nvoid | \n
\u8C03\u7528 showNotify
\u7B49\u65B9\u6CD5\u65F6\uFF0C\u652F\u6301\u4F20\u5165\u4EE5\u4E0B\u9009\u9879\uFF1A
\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
type | \n\u7C7B\u578B\uFF0C\u53EF\u9009\u503C\u4E3A primary success warning | \nNotifyType | \ndanger | \n
message | \n\u5C55\u793A\u6587\u6848\uFF0C\u652F\u6301\u901A\u8FC7\\n \u6362\u884C | \nstring | \n- | \n
duration | \n\u5C55\u793A\u65F6\u957F(ms)\uFF0C\u503C\u4E3A 0 \u65F6\uFF0Cnotify \u4E0D\u4F1A\u6D88\u5931 | \nnumber | string | \n3000 | \n
z-index | \n\u5C06\u7EC4\u4EF6\u7684 z-index \u5C42\u7EA7\u8BBE\u7F6E\u4E3A\u4E00\u4E2A\u56FA\u5B9A\u503C | \nnumber | string | \n2000+ | \n
position | \n\u5F39\u51FA\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A bottom | \nNotifyPosition | \ntop | \n
color | \n\u5B57\u4F53\u989C\u8272 | \nstring | \nwhite | \n
background | \n\u80CC\u666F\u989C\u8272 | \nstring | \n- | \n
className | \n\u81EA\u5B9A\u4E49\u7C7B\u540D | \nstring | Array | object | \n- | \n
lockScroll | \n\u662F\u5426\u9501\u5B9A\u80CC\u666F\u6EDA\u52A8 | \nboolean | \nfalse | \n
teleport | \n\u6307\u5B9A\u6302\u8F7D\u7684\u8282\u70B9\uFF0C\u7B49\u540C\u4E8E Teleport \u7EC4\u4EF6\u7684 to \u5C5E\u6027 | \nstring | Element | \n- | \n
onClick | \n\u70B9\u51FB\u65F6\u7684\u56DE\u8C03\u51FD\u6570 | \n(event: MouseEvent): void | \n- | \n
onOpened | \n\u5B8C\u5168\u5C55\u793A\u540E\u7684\u56DE\u8C03\u51FD\u6570 | \n() => void | \n- | \n
onClose | \n\u5173\u95ED\u65F6\u7684\u56DE\u8C03\u51FD\u6570 | \n() => void | \n- | \n
\u901A\u8FC7\u7EC4\u4EF6\u8C03\u7528 Notify
\u65F6\uFF0C\u652F\u6301\u4EE5\u4E0B Props\uFF1A
\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
v-model:show | \n\u662F\u5426\u663E\u793A\u901A\u77E5 | \nboolean | \nfalse | \n
type | \n\u7C7B\u578B\uFF0C\u53EF\u9009\u503C\u4E3A primary success warning | \nNotifyType | \ndanger | \n
message | \n\u5C55\u793A\u6587\u6848\uFF0C\u652F\u6301\u901A\u8FC7\\n \u6362\u884C | \nstring | \n- | \n
z-index | \n\u5C06\u7EC4\u4EF6\u7684 z-index \u5C42\u7EA7\u8BBE\u7F6E\u4E3A\u4E00\u4E2A\u56FA\u5B9A\u503C | \nnumber | string | \n2000+ | \n
position | \n\u5F39\u51FA\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A bottom | \nNotifyPosition | \ntop | \n
color | \n\u5B57\u4F53\u989C\u8272 | \nstring | \nwhite | \n
background | \n\u80CC\u666F\u989C\u8272 | \nstring | \n- | \n
class-name | \n\u81EA\u5B9A\u4E49\u7C7B\u540D | \nstring | Array | object | \n- | \n
lock-scroll | \n\u662F\u5426\u9501\u5B9A\u80CC\u666F\u6EDA\u52A8 | \nboolean | \nfalse | \n
teleport | \n\u6307\u5B9A\u6302\u8F7D\u7684\u8282\u70B9\uFF0C\u7B49\u540C\u4E8E Teleport \u7EC4\u4EF6\u7684 to \u5C5E\u6027 | \nstring | Element | \n- | \n
\u901A\u8FC7\u7EC4\u4EF6\u8C03\u7528 Notify
\u65F6\uFF0C\u652F\u6301\u4EE5\u4E0B\u4E8B\u4EF6\uFF1A
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
click | \n\u70B9\u51FB\u65F6\u7684\u56DE\u8C03\u51FD\u6570 | \nevent: MouseEvent | \n
close | \n\u5173\u95ED\u65F6\u7684\u56DE\u8C03\u51FD\u6570 | \n- | \n
opened | \n\u5B8C\u5168\u5C55\u793A\u540E\u7684\u56DE\u8C03\u51FD\u6570 | \n- | \n
\u901A\u8FC7\u7EC4\u4EF6\u8C03\u7528 Notify
\u65F6\uFF0C\u652F\u6301\u4EE5\u4E0B\u63D2\u69FD\uFF1A
\u540D\u79F0 | \n\u8BF4\u660E | \n
---|---|
default | \n\u81EA\u5B9A\u4E49\u5185\u5BB9 | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type {\n NotifyType,\n NotifyProps,\n NotifyOptions,\n NotifyPosition,\n} from 'vant';\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-notify-text-color | \nvar(--van-white) | \n- | \n
--van-notify-padding | \nvar(--van-padding-xs) var(--van-padding-md) | \n- | \n
--van-notify-font-size | \nvar(--van-font-size-md) | \n- | \n
--van-notify-line-height | \nvar(--van-line-height-md) | \n- | \n
--van-notify-primary-background | \nvar(--van-primary-color) | \n- | \n
--van-notify-success-background | \nvar(--van-success-color) | \n- | \n
--van-notify-danger-background | \nvar(--van-danger-color) | \n- | \n
--van-notify-warning-background | \nvar(--van-warning-color) | \n- | \n
\u5982\u679C\u5F15\u7528 showNotify
\u65B9\u6CD5\u65F6\u51FA\u73B0\u4EE5\u4E0B\u62A5\u9519\uFF0C\u8BF4\u660E\u9879\u76EE\u4E2D\u4F7F\u7528\u4E86 babel-plugin-import
\u63D2\u4EF6\uFF0C\u5BFC\u81F4\u4EE3\u7801\u88AB\u9519\u8BEF\u7F16\u8BD1\u3002
These dependencies were not found:\n\n* vant/es/show-notify in ./src/xxx.js\n* vant/es/show-notify/style in ./src/xxx.js\n
\nVant \u4ECE 4.0 \u7248\u672C\u5F00\u59CB\u4E0D\u518D\u652F\u6301 babel-plugin-import
\u63D2\u4EF6\uFF0C\u8BF7\u53C2\u8003 \u8FC1\u79FB\u6307\u5357 \u79FB\u9664\u8BE5\u63D2\u4EF6\u3002