0
0
Fork 0

hotFix(VnTable): add ctrl + click

This commit is contained in:
Alex Moreno 2024-07-23 10:09:42 +02:00
parent ad87fd8311
commit 451619fb88
1 changed files with 19 additions and 0 deletions

View File

@ -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)
"
>
<slot :name="`column-${col.name}`" :col="col" :row="row">
<VnTableColumn