mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 17:31:02 +08:00
eb932c18c0
* feat(directives): resize add element argument * fix(components): [el-menu] fix warn & listen item * chore: move import order * fix(components): remove debounce
21 lines
421 B
TypeScript
21 lines
421 B
TypeScript
import {
|
|
addResizeListener,
|
|
removeResizeListener,
|
|
} from '@element-plus/utils/resize-event'
|
|
|
|
import type { ObjectDirective } from 'vue'
|
|
|
|
const Resize: ObjectDirective = {
|
|
beforeMount(el, binding) {
|
|
el._handleResize = () => {
|
|
el && binding.value?.(el)
|
|
}
|
|
addResizeListener(el, el._handleResize)
|
|
},
|
|
beforeUnmount(el) {
|
|
removeResizeListener(el, el._handleResize)
|
|
},
|
|
}
|
|
|
|
export default Resize
|