refactor(alert): support vue3

This commit is contained in:
07akioni 2020-09-10 16:07:59 +08:00
parent 728ebc5c92
commit c4b9ad5401
4 changed files with 28 additions and 14 deletions

View File

@ -29,5 +29,5 @@ no-icon
## Events
|Name|Parameters|Description|
|-|-|-|
|after-hide|`()`||
|close|`()`||
|after-leave|`()`|When close transition is done|
|leave|`()`|When you click close.|

View File

@ -30,5 +30,5 @@ no-icon
## Events
|名称|参数|说明|
|-|-|-|
|after-hide|`()`||
|close|`()`||
|after-leave|`()`|关闭动画结束触发|
|leave|`()`|点击关闭出发|

View File

@ -69,19 +69,28 @@
<script>
import NIcon from '../../icon'
import mdCheckmarkCircle from '../../_icons/md-checkmark-circle'
import mdAlert from '../../_icons/md-alert'
import mdInformationCircle from '../../_icons/md-information-circle'
import mdCloseCircle from '../../_icons/md-close-circle'
import mdClose from '../../_icons/md-close'
import FadeInHeightExpandTransition from '../../_transition/FadeInHeightExpandTransition'
import withapp from '../../_mixins/withapp'
import themeable from '../../_mixins/themeable'
import usecssr from '../../_mixins/usecssr'
import styles from './styles'
// icons
import mdCheckmarkCircle from '../../_icons/md-checkmark-circle'
import mdAlert from '../../_icons/md-alert'
import mdInformationCircle from '../../_icons/md-information-circle'
import mdCloseCircle from '../../_icons/md-close-circle'
import mdClose from '../../_icons/md-close'
export default {
name: 'Alert',
emits: [
'leave',
'after-leave',
// legacy
'close',
'after-hide'
],
components: {
NIcon,
mdCheckmarkCircle,
@ -134,8 +143,10 @@ export default {
this.visible = true
},
close () {
this.$emit('close')
this.$emit('leave')
this.visible = false
// legacy
this.$emit('close')
},
handleCloseClick () {
Promise
@ -146,6 +157,8 @@ export default {
})
},
handleAfterLeave () {
this.$emit('after-leave')
// legacy
this.$emit('after-hide')
}
}

View File

@ -4,9 +4,8 @@ zindexable
placeable 进行了大调整
- [ ] Form
- [ ] Upload
- [ ] affix
- [ ] alert
- [x] alert
- [ ] anchor
- [ ] auto-complete
- [ ] avatar
@ -78,7 +77,9 @@ placeable 进行了大调整
- [x] time
- [ ] time-picker
- [ ] timeline
- [ ] tooltip
- [x] tooltip
- ref
- [ ] transfer
- [ ] tree
- [x] typography
- [ ] upload