优化drawer组件的动画逻辑

master
yutent 2023-08-11 13:48:47 +08:00
parent c3cf60e656
commit 9cacff73d2
1 changed files with 8 additions and 4 deletions

View File

@ -6,6 +6,8 @@
import { css, html, Component, nextTick, styleMap } from 'wkit' import { css, html, Component, nextTick, styleMap } from 'wkit'
import '../icon/index.js'
const ANIMATION = { const ANIMATION = {
left: { left: {
custom: [ custom: [
@ -36,7 +38,7 @@ const ANIMATION = {
class Drawer extends Component { class Drawer extends Component {
static animation = {} static animation = {}
static props = { static props = {
title: '', title: 'str!',
from: 'right', from: 'right',
visible: { visible: {
type: Boolean, type: Boolean,
@ -46,8 +48,8 @@ class Drawer extends Component {
this.$refs.drawer.$animate(!v) this.$refs.drawer.$animate(!v)
} }
}, },
width: '', width: 'str!',
height: '', height: 'str!',
maskClose: false maskClose: false
} }
@ -129,7 +131,9 @@ class Drawer extends Component {
] ]
closeDrawer() { closeDrawer() {
this.$emit('close') this.visible = false
this.$emit('input', { value: false })
this.$emit('close', { value: false })
} }
mounted() { mounted() {