vxe-table-select-area
Version:
一个基于 vxe-table 的可区域选中复制、粘贴的组件
26 lines (21 loc) • 610 B
JavaScript
/* eslint-disable eqeqeq */
import { MOUSE_EVENT_CLICK_TYPE } from './constant'
/*
get mouse event key type by mousedown\mouseup\... event
*/
export function getMouseEventClickType (event) {
let result = null
if (!event) {
return result
}
const button =
typeof event.which !== 'undefined' ? event.which : event.button
if (button == 1) {
result = MOUSE_EVENT_CLICK_TYPE.LEFT_MOUSE
} else if (button == 2) {
result = MOUSE_EVENT_CLICK_TYPE.MIDDLE_MOUSE
} else if (button == 3) {
result = MOUSE_EVENT_CLICK_TYPE.RIGHT_MOUSE
}
return result
}