forked from verdnatura/salix-front
hotFix(VnTable): add ctrl + click
This commit is contained in:
parent
ad87fd8311
commit
451619fb88
|
@ -37,6 +37,10 @@ const $props = defineProps({
|
||||||
type: [Function, Boolean],
|
type: [Function, Boolean],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
rowCtrlClick: {
|
||||||
|
type: [Function, Boolean],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
redirect: {
|
redirect: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -203,6 +207,16 @@ const rowClickFunction = computed(() => {
|
||||||
return () => {};
|
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) {
|
function redirectFn(id) {
|
||||||
router.push({ path: `/${$props.redirect}/${id}` });
|
router.push({ path: `/${$props.redirect}/${id}` });
|
||||||
}
|
}
|
||||||
|
@ -417,6 +431,11 @@ defineExpose({
|
||||||
class="no-margin q-px-xs"
|
class="no-margin q-px-xs"
|
||||||
:class="[getColAlign(col), col.class, col.columnField?.class]"
|
:class="[getColAlign(col), col.class, col.columnField?.class]"
|
||||||
v-if="col.visible ?? true"
|
v-if="col.visible ?? true"
|
||||||
|
@click.ctrl="
|
||||||
|
($event) =>
|
||||||
|
rowCtrlClickFunction &&
|
||||||
|
rowCtrlClickFunction($event, row)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<slot :name="`column-${col.name}`" :col="col" :row="row">
|
<slot :name="`column-${col.name}`" :col="col" :row="row">
|
||||||
<VnTableColumn
|
<VnTableColumn
|
||||||
|
|
Loading…
Reference in New Issue