parent
dced59c65c
commit
dfcdf92f7a
|
@ -80,6 +80,11 @@ const Drawer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
domFocus() {
|
||||||
|
if (this.$refs.vcDrawer) {
|
||||||
|
this.$refs.vcDrawer.domFocus();
|
||||||
|
}
|
||||||
|
},
|
||||||
close(e) {
|
close(e) {
|
||||||
this.$emit('close', e);
|
this.$emit('close', e);
|
||||||
},
|
},
|
||||||
|
@ -95,9 +100,14 @@ const Drawer = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
pull() {
|
pull() {
|
||||||
this.setState({
|
this.setState(
|
||||||
_push: false,
|
{
|
||||||
});
|
_push: false,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.domFocus();
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
onDestroyTransitionEnd() {
|
onDestroyTransitionEnd() {
|
||||||
const isDestroyOnClose = this.getDestroyOnClose();
|
const isDestroyOnClose = this.getDestroyOnClose();
|
||||||
|
@ -211,6 +221,7 @@ const Drawer = {
|
||||||
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
||||||
|
|
||||||
const vcDrawerProps = {
|
const vcDrawerProps = {
|
||||||
|
ref: 'vcDrawer',
|
||||||
props: {
|
props: {
|
||||||
...omit(rest, [
|
...omit(rest, [
|
||||||
'closable',
|
'closable',
|
||||||
|
|
|
@ -85,6 +85,9 @@ const Drawer = {
|
||||||
this.getDefault(this.$props);
|
this.getDefault(this.$props);
|
||||||
if (open) {
|
if (open) {
|
||||||
this.isOpenChange = true;
|
this.isOpenChange = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.domFocus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
}
|
}
|
||||||
|
@ -103,6 +106,11 @@ const Drawer = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.preProps.open = val;
|
this.preProps.open = val;
|
||||||
|
if (val) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.domFocus();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
placement(val) {
|
placement(val) {
|
||||||
if (val !== this.preProps.placement) {
|
if (val !== this.preProps.placement) {
|
||||||
|
@ -140,6 +148,11 @@ const Drawer = {
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
domFocus() {
|
||||||
|
if (this.dom) {
|
||||||
|
this.dom.focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
onKeyDown(e) {
|
onKeyDown(e) {
|
||||||
if (e.keyCode === KeyCode.ESC) {
|
if (e.keyCode === KeyCode.ESC) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
Loading…
Reference in New Issue