2018-02-06 15:21:13 +08:00
|
|
|
<cn>
|
|
|
|
#### 位置
|
|
|
|
可以设置通知从右上角、右下角、左下角、左上角弹出。
|
|
|
|
</cn>
|
|
|
|
|
|
|
|
<us>
|
|
|
|
#### Placement
|
|
|
|
A notification box can pop up from `topRight` or `bottomRight` or `bottomLeft` or `topLeft`.
|
|
|
|
</us>
|
|
|
|
|
2019-10-09 18:32:23 +08:00
|
|
|
```tpl
|
2018-02-06 15:21:13 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
2018-03-20 21:48:01 +08:00
|
|
|
<a-select v-model="selected" :style="{ width: '120px', marginRight: '10px' }">
|
2018-05-15 09:52:44 +08:00
|
|
|
<a-select-option v-for="val in options" :key="val" :value="val">{{val}}</a-select-option>
|
2018-03-20 21:48:01 +08:00
|
|
|
</a-select>
|
2018-02-06 15:21:13 +08:00
|
|
|
<a-button type="primary" @click="openNotification">Open the notification box</a-button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
const options = ['topLeft', 'topRight', 'bottomLeft', 'bottomRight'];
|
|
|
|
export default {
|
2019-09-28 20:45:07 +08:00
|
|
|
data() {
|
2018-02-06 15:21:13 +08:00
|
|
|
return {
|
|
|
|
options,
|
|
|
|
selected: 'topRight',
|
2019-09-28 20:45:07 +08:00
|
|
|
};
|
2018-02-06 15:21:13 +08:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
selected(val) {
|
2018-04-08 21:17:20 +08:00
|
|
|
this.$notification.config({
|
2018-02-06 15:21:13 +08:00
|
|
|
placement: val,
|
|
|
|
});
|
2019-09-28 20:45:07 +08:00
|
|
|
},
|
2018-02-06 15:21:13 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2019-09-28 20:45:07 +08:00
|
|
|
openNotification(val) {
|
2018-04-08 21:17:20 +08:00
|
|
|
this.$notification.open({
|
2018-02-06 15:21:13 +08:00
|
|
|
message: 'Notification Title',
|
2019-09-28 20:45:07 +08:00
|
|
|
description:
|
|
|
|
'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
|
2018-02-06 15:21:13 +08:00
|
|
|
});
|
|
|
|
},
|
2019-09-28 20:45:07 +08:00
|
|
|
},
|
|
|
|
};
|
2018-02-06 15:21:13 +08:00
|
|
|
</script>
|
|
|
|
```
|