primevue-mirror/components/lib/dock/Dock.vue

60 lines
1.7 KiB
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
2023-08-05 12:45:17 +00:00
<div :class="containerClass" :style="style" v-bind="ptm('root')" data-pc-name="dock">
2023-11-08 12:48:23 +00:00
<DockSub :model="model" :templates="$slots" :tooltipOptions="tooltipOptions" :position="position" :menuId="menuId" :aria-label="ariaLabel" :aria-labelledby="ariaLabelledby" :tabindex="tabindex" :pt="pt" :unstyled="unstyled"></DockSub>
2022-09-06 12:03:37 +00:00
</div>
</template>
<script>
2023-05-30 12:56:18 +00:00
import BaseDock from './BaseDock.vue';
2022-09-06 12:03:37 +00:00
import DockSub from './DockSub.vue';
export default {
name: 'Dock',
2023-05-30 12:56:18 +00:00
extends: BaseDock,
2023-11-21 17:28:29 +00:00
matchMediaListener: null,
data() {
return {
2023-11-21 17:28:29 +00:00
query: null,
queryMatches: false
};
},
mounted() {
2023-11-21 17:28:29 +00:00
this.bindMatchMediaListener();
},
beforeUnmount() {
this.unbindMatchMediaListener();
},
methods: {
bindMatchMediaListener() {
if (!this.matchMediaListener) {
const query = matchMedia(`(max-width: ${this.breakpoint})`);
2023-11-21 17:28:29 +00:00
this.query = query;
this.queryMatches = query.matches;
2023-11-21 17:28:29 +00:00
this.matchMediaListener = () => {
this.queryMatches = query.matches;
this.mobileActive = false;
};
this.query.addEventListener('change', this.matchMediaListener);
}
},
unbindMatchMediaListener() {
if (this.matchMediaListener) {
this.query.removeEventListener('change', this.matchMediaListener);
this.matchMediaListener = null;
}
}
},
2023-08-05 12:45:17 +00:00
computed: {
containerClass() {
2023-08-07 11:05:37 +00:00
return [this.class, this.cx('root')];
2023-08-05 12:45:17 +00:00
}
},
2022-09-06 12:03:37 +00:00
components: {
DockSub
}
2022-09-14 11:26:01 +00:00
};
2022-09-06 12:03:37 +00:00
</script>