fix: layout sidebar collapsed, close #5373
parent
cec9414d5c
commit
5d9afb7d1c
|
@ -1,15 +1,6 @@
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
import type { PropType, ExtractPropTypes, CSSProperties } from 'vue';
|
import type { PropType, ExtractPropTypes, CSSProperties } from 'vue';
|
||||||
import {
|
import { inject, defineComponent, ref, watch, onMounted, onBeforeUnmount, provide } from 'vue';
|
||||||
watchEffect,
|
|
||||||
inject,
|
|
||||||
defineComponent,
|
|
||||||
ref,
|
|
||||||
watch,
|
|
||||||
onMounted,
|
|
||||||
onBeforeUnmount,
|
|
||||||
provide,
|
|
||||||
} from 'vue';
|
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import { tuple } from '../_util/type';
|
import { tuple } from '../_util/type';
|
||||||
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
import initDefaultProps from '../_util/props-util/initDefaultProps';
|
||||||
|
@ -123,7 +114,9 @@ export default defineComponent({
|
||||||
siderHook && siderHook.addSider(uniqueId);
|
siderHook && siderHook.addSider(uniqueId);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
watchEffect(() => {
|
watch(
|
||||||
|
() => props.breakpoint,
|
||||||
|
() => {
|
||||||
try {
|
try {
|
||||||
mql?.removeEventListener('change', responsiveHandler);
|
mql?.removeEventListener('change', responsiveHandler);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -141,7 +134,11 @@ export default defineComponent({
|
||||||
responsiveHandler(mql);
|
responsiveHandler(mql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue