import { Prop, toNative } from 'vue-facing-decorator'; import TsxComponent, { Component } from '../../app/vuetsx'; import { BreakpointHandler } from './ts/breakpoint-handler'; interface ContainerWithBreakpointsArgs { cssClass?: string; } @Component class ContainerWithBreakpointsComponent extends TsxComponent implements ContainerWithBreakpointsArgs { @Prop() cssClass: string; breakpointClass: string = null; _handler: any; mounted() { this._handler = () => { const newClass = BreakpointHandler.getBreakpointsForElement(this.$el); if (newClass != this.breakpointClass) { this.breakpointClass = newClass; } }; BreakpointHandler.addResizeHandler(this._handler); this._handler(); } beforeUnmount() { BreakpointHandler.removeResizeHandler(this._handler); this._handler = null; } render(h) { return
{this.$slots.default?.()}
; } } const ContainerWithBreakpoints = toNative(ContainerWithBreakpointsComponent); export default ContainerWithBreakpoints;