1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-12-28 20:10:22 +08:00

fix(deps): 修复自定义指令引起的热更新失效问题

ISSUES CLOSED: #45
This commit is contained in:
zclzone
2023-08-04 22:07:20 +08:00
parent 53830256f4
commit 65d4d3848d
5 changed files with 157 additions and 188 deletions

View File

@@ -74,3 +74,17 @@ export function debounce(method, wait, immediate) {
}
}
}
/**
*
* @param {HTMLElement} el
* @param {Function} cb
* @return {ResizeObserver}
*/
export function useResize(el, cb) {
const observer = new ResizeObserver((entries) => {
cb(entries[0].contentRect)
})
observer.observe(el)
return observer
}