vue-hooks-plus
Version:
Vue hooks library
19 lines (18 loc) • 371 B
JavaScript
const vue = require("vue");
function useWinResize(Action = () => {
}) {
const fn = () => {
vue.nextTick(() => {
Action();
});
};
vue.onMounted(() => {
window.addEventListener("resize", fn, false);
});
vue.onBeforeUnmount(() => {
window.removeEventListener("resize", fn);
});
return null;
}
module.exports = useWinResize;
;