vue2-s-cli
Version:
脚手架
34 lines • 1.05 kB
JavaScript
export default {
drag: (el) => {
let targetDom = el;
targetDom.onmousedown = (el) => {
if (el.target.className !== "el-dialog__header") return;
let disX = el.clientX - targetDom.offsetLeft;
let disY = el.clientY - targetDom.offsetTop;
document.onmousemove = (el) => {
let left = el.clientX - disX;
let top = el.clientY - disY;
targetDom.style.left = `${left}px`;
targetDom.style.top = `${top}px`;
}
document.onmouseup = () => {
document.onmousemove = null;
document.onmouseup = null;
}
}
},
selectLoadMore: {
inserted(el, binding) {
const selectDom = el.querySelector(
".el-select-dropdown .el-select-dropdown__wrap"
);
selectDom.addEventListener("scroll", function() {
//const buffer = 20; // 缓冲距离
const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
if (condition) {
binding.value();
}
});
}
}
}