diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 162c3a519..ef8d69729 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -37,6 +37,10 @@ const $props = defineProps({ type: [Function, Boolean], default: null, }, + rowCtrlClick: { + type: [Function, Boolean], + default: null, + }, redirect: { type: String, default: null, @@ -203,6 +207,16 @@ const rowClickFunction = computed(() => { return () => {}; }); +const rowCtrlClickFunction = computed(() => { + if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick; + if ($props.redirect) + return (evt, { id }) => { + stopEventPropagation(evt); + window.open(`/#/${$props.redirect}/${id}`, '_blank'); + }; + return () => {}; +}); + function redirectFn(id) { router.push({ path: `/${$props.redirect}/${id}` }); } @@ -417,6 +431,11 @@ defineExpose({ class="no-margin q-px-xs" :class="[getColAlign(col), col.class, col.columnField?.class]" v-if="col.visible ?? true" + @click.ctrl=" + ($event) => + rowCtrlClickFunction && + rowCtrlClickFunction($event, row) + " >