You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
383 B
18 lines
383 B
/**
|
|
* 监听屏幕尺寸改变封装
|
|
*/
|
|
import { watch } from 'vue';
|
|
import { storeToRefs } from 'pinia';
|
|
import { useThemeStore } from '@/store/modules/theme';
|
|
|
|
export function onSizeChange(hook: Function) {
|
|
if (!hook) {
|
|
return;
|
|
}
|
|
const themeStore = useThemeStore();
|
|
const { contentWidth } = storeToRefs(themeStore);
|
|
|
|
watch(contentWidth, () => {
|
|
hook();
|
|
});
|
|
}
|