@@ -18,7 +18,8 @@
|
||||
<div
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
class="grid gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
|
||||
class="grid gap-4 px-4 py-3 text-sm border-t border-slate-200"
|
||||
:class="canOpenItems ? 'hover:bg-slate-50 cursor-pointer' : ''"
|
||||
:style="{ gridTemplateColumns: gridCols }"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@@ -50,8 +51,10 @@ const props = withDefaults(defineProps<{
|
||||
items: any[]
|
||||
routePrefix: string
|
||||
showActions?: boolean
|
||||
canOpenItems?: boolean
|
||||
}>(), {
|
||||
showActions: false
|
||||
showActions: false,
|
||||
canOpenItems: true
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
@@ -62,6 +65,9 @@ const gridCols = computed(() => {
|
||||
})
|
||||
|
||||
const goToItem = (id: number) => {
|
||||
if (!props.canOpenItems) {
|
||||
return
|
||||
}
|
||||
router.push(`${props.routePrefix}/${id}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user