47 lines
959 B
Vue
47 lines
959 B
Vue
<script setup>
|
|
import {computed} from "vue";
|
|
|
|
const props = defineProps({
|
|
mode: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
routerLink: {
|
|
type: Object,
|
|
required: true
|
|
}
|
|
})
|
|
|
|
const config = computed(() => {
|
|
if (props.mode === "add") {
|
|
return {icon: "add", label: "Přidat"};
|
|
} else if (props.mode === "edit") {
|
|
return {icon: "edit", label: "Upravit"};
|
|
}
|
|
|
|
return {icon: "unknown", label: `Neznámý typ ${props.mode}`}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<q-toolbar class="justify-end q-pr-none" v-if="$q.screen.gt.sm">
|
|
<q-btn color="primary" size="lg" :icon="config.icon" :to="props.routerLink">{{ config.label }}</q-btn>
|
|
</q-toolbar>
|
|
|
|
<q-page-sticky
|
|
location="bottom"
|
|
:offset="[30, 30]"
|
|
v-else
|
|
>
|
|
<q-fab
|
|
:icon="config.icon"
|
|
color="primary"
|
|
:label="config.label"
|
|
@click="$router.push(props.routerLink)"
|
|
/>
|
|
</q-page-sticky>
|
|
</div>
|
|
</template>
|
|
|