From 131a51ec754d1fcb8765a24094d97b3e4a2b84f7 Mon Sep 17 00:00:00 2001 From: "Mr.Bai" <935196116@qq.com> Date: Tue, 22 Jun 2021 14:54:16 +0800 Subject: [PATCH 1/2] docs(message): add use not int setup demo (#215) * docs(message): use message outside of setup * docs(message): use html * Apply suggestions from code review * docs(message): put use message outside setup to Q&A section * Apply suggestions from code review Co-authored-by: tusimple Co-authored-by: 07akioni <07akioni2@gmail.com> --- src/message/demos/enUS/index.demo-entry.md | 44 ++++++++++++++++++++++ src/message/demos/zhCN/index.demo-entry.md | 44 ++++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/src/message/demos/enUS/index.demo-entry.md b/src/message/demos/enUS/index.demo-entry.md index 0ec4a6b45..1b99ac06c 100644 --- a/src/message/demos/enUS/index.demo-entry.md +++ b/src/message/demos/enUS/index.demo-entry.md @@ -94,3 +94,47 @@ multiple-line | Name | Type | Description | | ------- | ---- | ----------- | | destroy | `()` | | + +## Q & A + +### Use Message Outside Setup + + + + You need to mount the return value of useMessage to the window in the top-level setup and then call it. Before calling it, you need to make sure that message has been mounted successfully. + + +```html + + + + +``` + +```html + + + + +``` + +```js +// xxx.js +export const handler = () => { + // You need to ensure that window.$message = message has been executed in setup + window.$message.success( + 'Cause you walked hand in hand With another man in my place' + ) +} +``` + + diff --git a/src/message/demos/zhCN/index.demo-entry.md b/src/message/demos/zhCN/index.demo-entry.md index fb077eabf..75d33e5c3 100644 --- a/src/message/demos/zhCN/index.demo-entry.md +++ b/src/message/demos/zhCN/index.demo-entry.md @@ -94,3 +94,47 @@ multiple-line | 名称 | 类型 | 说明 | | ------- | ---- | ---- | | destroy | `()` | | + +## Q & A + +### 在 setup 外使用 + + + + 如果你想在 setup 外使用信息,你需要在顶层 setup 中把 useMessage 返回的 message 值挂载到 window 下然后再调用,调用前需要确保 message 已经挂载成功。 + + +```html + + + + +``` + +```html + + + + +``` + +```js +// xxx.js +export const handler = () => { + // 需要确保已经在 setup 中执行了 window.$message = message + window.$message.success( + 'Cause you walked hand in hand With another man in my place' + ) +} +``` + + From 4c13451496ca2ca596ad403d314220a78176a0fe Mon Sep 17 00:00:00 2001 From: djkloop <1044032256@qq.com> Date: Wed, 23 Jun 2021 00:08:01 +0800 Subject: [PATCH 2/2] docs(modal): remove show-mask (#247) --- src/modal/demos/enUS/index.demo-entry.md | 1 - src/modal/demos/zhCN/index.demo-entry.md | 1 - 2 files changed, 2 deletions(-) diff --git a/src/modal/demos/enUS/index.demo-entry.md b/src/modal/demos/enUS/index.demo-entry.md index 1424616fc..f90c3f18e 100644 --- a/src/modal/demos/enUS/index.demo-entry.md +++ b/src/modal/demos/enUS/index.demo-entry.md @@ -24,7 +24,6 @@ preset-confirm-slot | mask-closable | `boolean` | `true` | Whether to emit `hide` event when click mask. | | preset | `'card' \| 'confirm'` | `undefined` | | | show | `boolean` | `false` | Whether to show modal. | -| show-mask | `boolean` | `true` | Whether to show mask of the modal. | | on-update:show | `(value: boolean) => void` | `undefined` | Callback when modal's display status is changed. | ### Modal with Preset Card diff --git a/src/modal/demos/zhCN/index.demo-entry.md b/src/modal/demos/zhCN/index.demo-entry.md index 2aed00c24..822286844 100644 --- a/src/modal/demos/zhCN/index.demo-entry.md +++ b/src/modal/demos/zhCN/index.demo-entry.md @@ -35,7 +35,6 @@ dark-10-debug | mask-closable | `boolean` | `true` | 点击遮罩时是否发出 `update:show` 事件 | | preset | `'card' \| 'dialog'` | `undefined` | 模态框使用何种预设 | | show | `boolean` | `false` | 是否展示 Modal | -| show-mask | `boolean` | `true` | 是否展示 Modal 的遮罩 | | on-update:show | `(value: boolean) => void` | `undefined` | 模态框更新是否展示状态的回调 | ### Modal(Card 预设)