chore: detail optimization

This commit is contained in:
vben
2020-10-14 21:08:07 +08:00
parent 7437896034
commit 31e2715e67
27 changed files with 304 additions and 93 deletions

View 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>

View File

@@ -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 {};
},
});