mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 19:29:04 +08:00
chore: detail optimization
This commit is contained in:
17
src/views/demo/feat/tab-params/index.vue
Normal file
17
src/views/demo/feat/tab-params/index.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div class="p-4"> Current Param : {{ params }} </div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, unref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const { currentRoute } = useRouter();
|
||||
return {
|
||||
params: computed(() => {
|
||||
return unref(currentRoute).params;
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
@@ -2,7 +2,7 @@
|
||||
<div />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, onBeforeMount, unref } from 'vue';
|
||||
import { defineComponent, unref } from 'vue';
|
||||
|
||||
import { appStore } from '/@/store/modules/app';
|
||||
|
||||
@@ -11,21 +11,19 @@
|
||||
name: 'Redirect',
|
||||
setup() {
|
||||
const { currentRoute, replace } = useRouter();
|
||||
onBeforeMount(() => {
|
||||
const { params, query } = unref(currentRoute);
|
||||
const { path } = params;
|
||||
const _path = Array.isArray(path) ? path.join('/') : path;
|
||||
replace({
|
||||
path: '/' + _path,
|
||||
query,
|
||||
});
|
||||
const { openRouterTransition, openPageLoading } = appStore.getProjectConfig;
|
||||
if (openRouterTransition && openPageLoading) {
|
||||
setTimeout(() => {
|
||||
appStore.setPageLoadingAction(false);
|
||||
}, 0);
|
||||
}
|
||||
const { params, query } = unref(currentRoute);
|
||||
const { path } = params;
|
||||
const _path = Array.isArray(path) ? path.join('/') : path;
|
||||
replace({
|
||||
path: '/' + _path,
|
||||
query,
|
||||
});
|
||||
const { openRouterTransition, openPageLoading } = appStore.getProjectConfig;
|
||||
if (openRouterTransition && openPageLoading) {
|
||||
setTimeout(() => {
|
||||
appStore.setPageLoadingAction(false);
|
||||
}, 0);
|
||||
}
|
||||
return {};
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user