diff --git a/src/style/var.less b/src/style/var.less
index a40138923..e8a76cdb1 100644
--- a/src/style/var.less
+++ b/src/style/var.less
@@ -806,8 +806,8 @@
@toast-default-padding: @padding-md;
@toast-default-width: 88px;
@toast-default-min-height: 88px;
-@toast-position-top-distance: 50px;
-@toast-position-bottom-distance: 50px;
+@toast-position-top-distance: 20%;
+@toast-position-bottom-distance: 20%;
// TreeSelect
@tree-select-font-size: @font-size-md;
diff --git a/src/toast/README.md b/src/toast/README.md
index 92b18dc77..71e08707c 100644
--- a/src/toast/README.md
+++ b/src/toast/README.md
@@ -53,6 +53,20 @@ Toast.loading({
});
```
+### Custom Position
+
+```js
+Toast({
+ message: 'Top',
+ position: 'top',
+});
+
+Toast({
+ message: 'Bottom',
+ position: 'bottom',
+});
+```
+
### Update Message
```js
diff --git a/src/toast/README.zh-CN.md b/src/toast/README.zh-CN.md
index 602f5397a..7418544c0 100644
--- a/src/toast/README.zh-CN.md
+++ b/src/toast/README.zh-CN.md
@@ -64,6 +64,22 @@ Toast.loading({
});
```
+### 自定义位置
+
+Toast 默认渲染在屏幕正中位置,通过 `position` 属性可以控制 Toast 展示的位置。
+
+```js
+Toast({
+ message: '顶部展示',
+ position: 'top',
+});
+
+Toast({
+ message: '底部展示',
+ position: 'bottom',
+});
+```
+
### 动态更新提示
执行 Toast 方法时会返回对应的 Toast 实例,通过修改实例上的 message 属性可以实现动态更新提示的效果。
diff --git a/src/toast/demo/index.vue b/src/toast/demo/index.vue
index e56dbe69c..f9a10075f 100644
--- a/src/toast/demo/index.vue
+++ b/src/toast/demo/index.vue
@@ -17,6 +17,11 @@
/>
+
+
+
+
+
`倒计时 ${second} 秒`,
+ title1: '文字提示',
+ title2: '加载提示',
+ title3: '成功/失败提示',
+ success: '成功提示',
customIcon: '自定义图标',
customImage: '自定义图片',
- text4: (second) => `倒计时 ${second} 秒`,
- updateMessage: '动态更新提示',
loadingType: '自定义加载图标',
+ positionTop: '顶部展示',
+ updateMessage: '动态更新提示',
+ positionBottom: '底部展示',
+ customPosition: '自定义位置',
},
'en-US': {
- title1: 'Text',
- title2: 'Loading',
- title3: 'Success/Fail',
- success: 'Success',
fail: 'Fail',
text: 'Some messages',
text2: 'Success',
text3: 'Fail',
+ text4: (second) => `${second} seconds`,
+ title1: 'Text',
+ title2: 'Loading',
+ title3: 'Success/Fail',
+ success: 'Success',
customIcon: 'Custom Icon',
customImage: 'Custom Image',
- text4: (second) => `${second} seconds`,
- updateMessage: 'Update Message',
loadingType: 'Loading Type',
+ positionTop: 'Top',
+ updateMessage: 'Update Message',
+ positionBottom: 'Bottom',
+ customPosition: 'Custom Position',
},
},
@@ -79,6 +90,20 @@ export default {
this.$toast.fail(this.t('text3'));
},
+ showTopToast() {
+ this.$toast({
+ message: this.t('positionTop'),
+ position: 'top',
+ });
+ },
+
+ showBottomToast() {
+ this.$toast({
+ message: this.t('positionBottom'),
+ position: 'bottom',
+ });
+ },
+
showIconToast() {
this.$toast({
message: this.t('customIcon'),
diff --git a/src/toast/test/__snapshots__/demo.spec.js.snap b/src/toast/test/__snapshots__/demo.spec.js.snap
index 6a1e4449e..86f4e1ebb 100644
--- a/src/toast/test/__snapshots__/demo.spec.js.snap
+++ b/src/toast/test/__snapshots__/demo.spec.js.snap
@@ -34,6 +34,16 @@ exports[`renders demo correctly 1`] = `
+