perf: optimize the issue of animation when switching setting tabs (#748)

#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

优化主题和插件详情页面切换 tab 时的页面闪动问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2856

#### Special notes for your reviewer:

测试方式:检查在主题和插件详情页面是否还存在 https://github.com/halo-dev/halo/issues/2856 中提到的问题。

#### Does this PR introduce a user-facing change?

```release-note
优化 Console 端的主题和插件详情页面切换选项卡时的页面闪动问题。
```
pull/758/head
Ryan Wang 2022-12-07 12:26:54 +08:00 committed by GitHub
parent 26ed1ecf04
commit 5a8b046862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 39 deletions

View File

@ -55,7 +55,7 @@ const onUpgradeModalClose = () => {
</script> </script>
<template> <template>
<Transition appear mode="out-in" name="fade"> <Transition mode="out-in" name="fade">
<div> <div>
<div class="bg-white px-4 py-4 sm:px-6"> <div class="bg-white px-4 py-4 sm:px-6">
<div class="group flex items-center justify-between"> <div class="group flex items-center justify-between">

View File

@ -53,7 +53,7 @@ watch(
); );
</script> </script>
<template> <template>
<Transition appear mode="out-in" name="fade"> <Transition mode="out-in" name="fade">
<div class="bg-white p-4"> <div class="bg-white p-4">
<div> <div>
<FormKit <FormKit

View File

@ -59,7 +59,7 @@ watchEffect(() => {
</script> </script>
<template> <template>
<Transition appear mode="out-in" name="fade"> <Transition mode="out-in" name="fade">
<div> <div>
<div class="flex items-center justify-between bg-white px-4 py-4 sm:px-6"> <div class="flex items-center justify-between bg-white px-4 py-4 sm:px-6">
<div> <div>

View File

@ -62,7 +62,7 @@ const handleFetchPlugin = async () => {
await handleFetchPlugin(); await handleFetchPlugin();
</script> </script>
<template> <template>
<Transition appear mode="out-in" name="fade"> <Transition mode="out-in" name="fade">
<div class="bg-white p-4"> <div class="bg-white p-4">
<div> <div>
<FormKit <FormKit

View File

@ -33,36 +33,31 @@ await handleFetchSettings();
await handleFetchConfigMap(); await handleFetchConfigMap();
</script> </script>
<template> <template>
<Transition appear mode="out-in" name="fade"> <div class="bg-white p-4">
<div class="bg-white p-4"> <div>
<div> <FormKit
<FormKit v-if="group && formSchema && configMapFormData"
v-if="group && formSchema && configMapFormData" :id="group"
:id="group" v-model="configMapFormData[group]"
v-model="configMapFormData[group]" :name="group"
:name="group" :actions="false"
:actions="false" :preserve="true"
:preserve="true" type="form"
type="form" @submit="handleSaveConfigMap"
@submit="handleSaveConfigMap" >
<FormKitSchema :schema="formSchema" :data="configMapFormData[group]" />
</FormKit>
</div>
<div v-permission="['system:configmaps:manage']" class="pt-5">
<div class="flex justify-start">
<VButton
:loading="saving"
type="secondary"
@click="$formkit.submit(group || '')"
> >
<FormKitSchema 保存
:schema="formSchema" </VButton>
:data="configMapFormData[group]"
/>
</FormKit>
</div>
<div v-permission="['system:configmaps:manage']" class="pt-5">
<div class="flex justify-start">
<VButton
:loading="saving"
type="secondary"
@click="$formkit.submit(group || '')"
>
保存
</VButton>
</div>
</div> </div>
</div> </div>
</Transition> </div>
</template> </template>

View File

@ -113,12 +113,14 @@ watch([() => route.name, () => route.params], async () => {
<div class="bg-white"> <div class="bg-white">
<RouterView :key="activeTab" v-slot="{ Component }"> <RouterView :key="activeTab" v-slot="{ Component }">
<template v-if="Component"> <template v-if="Component">
<Suspense> <Transition appear mode="out-in" name="fade">
<component :is="Component"></component> <Suspense>
<template #fallback> <component :is="Component"></component>
<VLoading /> <template #fallback>
</template> <VLoading />
</Suspense> </template>
</Suspense>
</Transition>
</template> </template>
</RouterView> </RouterView>
</div> </div>