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],
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue