zcloud-ui
Version:
A Component Library for Vue.js.
19 lines (15 loc) • 374 B
JavaScript
import { debounce } from 'lodash';
let height = 0;
const myUpdate = (el, binding, vnode) => {
const style = document.defaultView.getComputedStyle(el);
if (height !== style.height) {
binding.value(); // 关键
height = style.height;
}
};
const debounceFunc = debounce(myUpdate, 200);
export default {
update (...rest) {
debounceFunc(...rest);
}
};