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