poc
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
5799a1121b
commit
4fe720c090
|
@ -0,0 +1,16 @@
|
|||
import { useRouter, useRoute } from 'vue-router';
|
||||
|
||||
export function useNavigate() {
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
function navigate(id, action = 'Card') {
|
||||
router.push({ name: `${route.meta.moduleName}${action}`, params: { id } });
|
||||
}
|
||||
|
||||
function redirectToView(name, action = 'Create') {
|
||||
router.push({ name: name ?? `${route.meta.moduleName}${action}` });
|
||||
}
|
||||
|
||||
return { navigate, redirectToView };
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
<script setup>
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
|
@ -11,20 +10,14 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate } from 'src/filters/index';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useNavigate } from 'src/composables/useNavigate';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const { redirectToView, navigate } = useNavigate();
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/entry/${id}` });
|
||||
}
|
||||
|
||||
const redirectToCreateView = () => {
|
||||
router.push({ name: 'EntryCreate' });
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
@ -121,7 +114,7 @@ onMounted(async () => {
|
|||
</div>
|
||||
</QPage>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
||||
<QBtn fab icon="add" color="primary" @click="redirectToView()" />
|
||||
<QTooltip>
|
||||
{{ t('entry.list.newEntry') }}
|
||||
</QTooltip>
|
||||
|
|
Loading…
Reference in New Issue