2018-02-06 07:21:13 +00:00
|
|
|
|
|
|
|
<cn>
|
2018-09-21 02:00:52 +00:00
|
|
|
#### 自定义按钮
|
|
|
|
自定义关闭按钮的样式和文字。
|
2018-02-06 07:21:13 +00:00
|
|
|
</cn>
|
|
|
|
|
|
|
|
<us>
|
2018-09-21 02:00:52 +00:00
|
|
|
#### Custom close button
|
|
|
|
To customize the style or font of the close button.
|
2018-02-06 07:21:13 +00:00
|
|
|
</us>
|
|
|
|
|
|
|
|
```html
|
|
|
|
<template>
|
|
|
|
<a-button type="primary" @click="openNotification">Open the notification box</a-button>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
const close = () => {
|
|
|
|
console.log('Notification was closed. Either the close button was clicked or duration time elapsed.');
|
|
|
|
};
|
|
|
|
export default {
|
|
|
|
methods: {
|
|
|
|
openNotification () {
|
|
|
|
const key = `open${Date.now()}`;
|
2018-04-08 13:17:20 +00:00
|
|
|
this.$notification.open({
|
2018-02-06 07:21:13 +00:00
|
|
|
message: 'Notification Title',
|
|
|
|
description: 'A function will be be called after the notification is closed (automatically after the "duration" time of manually).',
|
|
|
|
btn: (h)=>{
|
|
|
|
return h('a-button', {
|
|
|
|
props: {
|
|
|
|
type: 'primary',
|
|
|
|
size: 'small',
|
|
|
|
},
|
|
|
|
on: {
|
2018-04-08 13:17:20 +00:00
|
|
|
click: () => this.$notification.close(key)
|
2018-02-06 07:21:13 +00:00
|
|
|
}
|
|
|
|
}, 'Confirm')
|
|
|
|
},
|
|
|
|
key,
|
|
|
|
onClose: close,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
```
|
|
|
|
|