diff --git a/package.json b/package.json index 14a2f9e..af0a1d5 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "HC200ok", "description": "A customizable and easy-to-use data table component made with Vue.js 3.x.", "private": false, - "version": "1.5.43", + "version": "1.5.44", "types": "./types/main.d.ts", "license": "MIT", "files": [ diff --git a/src/components/DataTable.vue b/src/components/DataTable.vue index 5efe341..e51b2ab 100644 --- a/src/components/DataTable.vue +++ b/src/components/DataTable.vue @@ -133,7 +133,7 @@ clickRowToExpand && updateExpandingItemIndexList(index + prevPageEndIndex, item, $event); }" @dblclick="($event) => {clickRow(item, 'double', $event)}" - @contextmenu.prevent="($event) => {emits('contextmenuRow', item, $event)}" + @contextmenu="($event) => {contextMenuRow(item, $event)}" > { + if (preventContextMenuRow.value) $event.preventDefault(); + emits('contextmenuRow', item, $event); +} + // template style generation function const getColStyle = (header: HeaderForRender): string | undefined => { const width = header.width ?? (fixedHeaders.value.length ? 100 : null); diff --git a/src/propsWithDefault.ts b/src/propsWithDefault.ts index ca60642..b6d2298 100644 --- a/src/propsWithDefault.ts +++ b/src/propsWithDefault.ts @@ -194,5 +194,9 @@ export default { showIndexSymbol: { type: String, default: '#', + }, + preventContextMenuRow: { + type: Boolean, + default: true } };