chore: rename unreleased API (#10803)

This commit is contained in:
neverland 2022-07-09 15:38:28 +08:00 committed by GitHub
parent 1bc6cbdb69
commit 5a3fe7ed0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 20 deletions

View File

@ -84,7 +84,7 @@ Dialog; // 组件对象
Dialog(); // -> showDialog() Dialog(); // -> showDialog()
Dialog.alert(); // -> showDialog() Dialog.alert(); // -> showDialog()
Dialog.confirm(); // -> showConfirmDialog() Dialog.confirm(); // -> showConfirmDialog()
Dialog.close(); // -> hideDialog(); Dialog.close(); // -> closeDialog();
Dialog.setDefaultOptions(); // -> setDialogDefaultOptions() Dialog.setDefaultOptions(); // -> setDialogDefaultOptions()
Dialog.resetDefaultOptions(); // -> resetDialogDefaultOptions() Dialog.resetDefaultOptions(); // -> resetDialogDefaultOptions()
``` ```
@ -138,7 +138,7 @@ Notify; // 组件对象
```js ```js
Notify(); // -> showNotify() Notify(); // -> showNotify()
Notify.clear(); // -> hideNotify() Notify.clear(); // -> closeNotify()
Notify.setDefaultOptions(); // -> setNotifyDefaultOptions() Notify.setDefaultOptions(); // -> setNotifyDefaultOptions()
Notify.resetDefaultOptions(); // -> resetNotifyDefaultOptions() Notify.resetDefaultOptions(); // -> resetNotifyDefaultOptions()
``` ```

View File

@ -133,7 +133,7 @@ export default {
| --- | --- | --- | --- | | --- | --- | --- | --- |
| showDialog | Show dialog | _options: DialogOptions_ | `Promise<void>` | | showDialog | Show dialog | _options: DialogOptions_ | `Promise<void>` |
| showConfirmDialog | Show confirm dialog | _options: DialogOptions_ | `Promise<void>` | | showConfirmDialog | Show confirm dialog | _options: DialogOptions_ | `Promise<void>` |
| hideDialog | Close dialog | - | `void` | | closeDialog | Close dialog | - | `void` |
| setDialogDefaultOptions | Set default options of all dialogs | _options: DialogOptions_ | `void` | | setDialogDefaultOptions | Set default options of all dialogs | _options: DialogOptions_ | `void` |
| resetDialogDefaultOptions | Reset default options of all dialogs | - | `void` | | resetDialogDefaultOptions | Reset default options of all dialogs | - | `void` |

View File

@ -150,7 +150,7 @@ export default {
| --- | --- | --- | --- | | --- | --- | --- | --- |
| showDialog | 展示弹窗 | _options: DialogOptions_ | `Promise<void>` | | showDialog | 展示弹窗 | _options: DialogOptions_ | `Promise<void>` |
| showConfirmDialog | 展示消息确认弹窗 | _options: DialogOptions_ | `Promise<void>` | | showConfirmDialog | 展示消息确认弹窗 | _options: DialogOptions_ | `Promise<void>` |
| hideDialog | 关闭弹窗 | - | `void` | | closeDialog | 关闭弹窗 | - | `void` |
| setDialogDefaultOptions | 修改默认配置,影响所有的 `showDialog` 调用 | _options: DialogOptions_ | `void` | | setDialogDefaultOptions | 修改默认配置,影响所有的 `showDialog` 调用 | _options: DialogOptions_ | `void` |
| resetDialogDefaultOptions | 重置默认配置,影响所有的 `showDialog` 调用 | - | `void` | | resetDialogDefaultOptions | 重置默认配置,影响所有的 `showDialog` 调用 | - | `void` |

View File

@ -78,7 +78,7 @@ export const resetDialogDefaultOptions = () => {
export const showConfirmDialog = (options: DialogOptions) => export const showConfirmDialog = (options: DialogOptions) =>
showDialog(extend({ showCancelButton: true }, options)); showDialog(extend({ showCancelButton: true }, options));
export const hideDialog = () => { export const closeDialog = () => {
if (instance) { if (instance) {
instance.toggle(false); instance.toggle(false);
} }

View File

@ -5,7 +5,7 @@ export const Dialog = withInstall(_Dialog);
export default Dialog; export default Dialog;
export { export {
showDialog, showDialog,
hideDialog, closeDialog,
showConfirmDialog, showConfirmDialog,
setDialogDefaultOptions, setDialogDefaultOptions,
resetDialogDefaultOptions, resetDialogDefaultOptions,

View File

@ -1,7 +1,7 @@
import { later } from '../../../test'; import { later } from '../../../test';
import { import {
showDialog, showDialog,
hideDialog, closeDialog,
setDialogDefaultOptions, setDialogDefaultOptions,
resetDialogDefaultOptions, resetDialogDefaultOptions,
} from '../function-call'; } from '../function-call';
@ -34,7 +34,7 @@ test('should render dialog after calling showDialog', async () => {
expect(dialog).toBeTruthy(); expect(dialog).toBeTruthy();
}); });
test('should close dialog after calling hideDialog', async () => { test('should close dialog after calling closeDialog', async () => {
const wrapper = document.createElement('div'); const wrapper = document.createElement('div');
showDialog({ showDialog({
message: '1', message: '1',
@ -45,7 +45,7 @@ test('should close dialog after calling hideDialog', async () => {
const dialog = wrapper.querySelector('.van-dialog'); const dialog = wrapper.querySelector('.van-dialog');
expect(dialog.style.display).toEqual(''); expect(dialog.style.display).toEqual('');
hideDialog(); closeDialog();
await later(); await later();
expect(dialog.className.split(' ')).toContain( expect(dialog.className.split(' ')).toContain(
'van-dialog-bounce-leave-active' 'van-dialog-bounce-leave-active'

View File

@ -33,13 +33,13 @@ showNotify('Notify Message');
### Basic Usage ### Basic Usage
```js ```js
import { showNotify, hideNotify } from 'vant'; import { showNotify, closeNotify } from 'vant';
// auto close after 3s // auto close after 3s
showNotify('Message'); showNotify('Message');
// manually close // manually close
hideNotify(); closeNotify();
``` ```
### Notify Type ### Notify Type
@ -114,7 +114,7 @@ export default {
| Methods | Attribute | Return value | Description | | Methods | Attribute | Return value | Description |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| showNotify | `options \| message` | notify instance | Show notify | | showNotify | `options \| message` | notify instance | Show notify |
| hideNotify | - | `void` | Close notify | | closeNotify | - | `void` | Close notify |
| setNotifyDefaultOptions | `options` | `void` | Set default options of all notifies | | setNotifyDefaultOptions | `options` | `void` | Set default options of all notifies |
| resetNotifyDefaultOptions | - | `void` | Reset default options of all notifies | | resetNotifyDefaultOptions | - | `void` | Reset default options of all notifies |

View File

@ -33,13 +33,13 @@ showNotify({ message: '提示' });
### 基础用法 ### 基础用法
```js ```js
import { showNotify, hideNotify } from 'vant'; import { showNotify, closeNotify } from 'vant';
// 3 秒后自动关闭 // 3 秒后自动关闭
showNotify('通知内容'); showNotify('通知内容');
// 主动关闭 // 主动关闭
hideNotify(); closeNotify();
``` ```
### 通知类型 ### 通知类型
@ -127,7 +127,7 @@ export default {
| 方法名 | 说明 | 参数 | 返回值 | | 方法名 | 说明 | 参数 | 返回值 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| showNotify | 展示提示 | `options \| message` | notify 实例 | | showNotify | 展示提示 | `options \| message` | notify 实例 |
| hideNotify | 关闭提示 | - | `void` | | closeNotify | 关闭提示 | - | `void` |
| setNotifyDefaultOptions | 修改默认配置,影响所有的 `showNotify` 调用 | `options` | `void` | | setNotifyDefaultOptions | 修改默认配置,影响所有的 `showNotify` 调用 | `options` | `void` |
| resetNotifyDefaultOptions | 重置默认配置,影响所有的 `showNotify` 调用 | - | `void` | | resetNotifyDefaultOptions | 重置默认配置,影响所有的 `showNotify` 调用 | - | `void` |

View File

@ -34,7 +34,7 @@ const getDefaultOptions = (): NotifyOptions => ({
let currentOptions = getDefaultOptions(); let currentOptions = getDefaultOptions();
export const hideNotify = () => { export const closeNotify = () => {
if (instance) { if (instance) {
instance.toggle(false); instance.toggle(false);
} }
@ -55,7 +55,7 @@ export function showNotify(options: NotifyMessage | NotifyOptions) {
clearTimeout(timer); clearTimeout(timer);
if (options.duration! > 0) { if (options.duration! > 0) {
timer = window.setTimeout(hideNotify, options.duration); timer = window.setTimeout(closeNotify, options.duration);
} }
return instance; return instance;

View File

@ -5,7 +5,7 @@ export const Notify = withInstall(_Notify);
export default Notify; export default Notify;
export { export {
showNotify, showNotify,
hideNotify, closeNotify,
setNotifyDefaultOptions, setNotifyDefaultOptions,
resetNotifyDefaultOptions, resetNotifyDefaultOptions,
} from './function-call'; } from './function-call';

View File

@ -1,13 +1,13 @@
import { later } from '../../../test'; import { later } from '../../../test';
import { import {
showNotify, showNotify,
hideNotify, closeNotify,
setNotifyDefaultOptions, setNotifyDefaultOptions,
resetNotifyDefaultOptions, resetNotifyDefaultOptions,
} from '../function-call'; } from '../function-call';
test('should not throw error if calling clear method before render notify', () => { test('should not throw error if calling clear method before render notify', () => {
hideNotify(); closeNotify();
}); });
test('should render Notify correctly', async () => { test('should render Notify correctly', async () => {