vue-vben-admin/src/layouts/page/index.vue

75 lines
2.1 KiB
Vue
Raw Normal View History

2021-01-09 23:28:52 +08:00
<template>
<RouterView>
<template #default="{ Component, route }">
<transition
:name="
getTransitionName({
route,
openCache,
enableTransition: getEnableTransition,
cacheTabs: getCaches,
def: getBasicTransition,
})
"
mode="out-in"
appear
>
<keep-alive v-if="openCache" :include="getCaches">
添加 Form ApiTransfer , 修复标签页切换灰屏不显示内容问题 (#2052) * Table BasicColumn 添加 editDynamicDisabled Co-authored-by: Cyrus Zhou <6802207@qq.com> 使用方式同 Form FormSchema dynamicDisabled ``` export const Columns: BasicColumn[] = [ { title: 'Title', dataIndex: 'Title', editRow: true, editComponent: 'Select', editDynamicDisabled: ({ record }) => record.isDisabled, }, * editComponentProps onChange 功能恢复 Co-authored-by: Cyrus Zhou <6802207@qq.com> 说明: ...omit(compProps, 'onChange') 这会忽略 onChange ,导致 editComponentProps onChange 被取消 如下功能将不支持: ``` editComponentProps: ({ record }) => { return { options: effectTypeData, onChange: () => { }, }; }, ``` * tableData == null 报错 * ApiSelect 第一次选择触发required错误提示问题 * 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值 * 修复标签页切换灰屏不显示内容问题 Co-authored-by: Cyrus Zhou <6802207@qq.com> 问题描述页面没有用 div 包括 会提示 Component inside <Transition> renders non-element root node that cannot be animated , 导致页灰屏必须刷新页面才可以显示内容 * 添加 Form ApiTransfer ## 使用方式 api 方式: ``` ...... component: 'ApiTransfer', componentProps: { api: sysUserSelector, labelField: 'name', valueField: 'id', }, ..... ``` 数据方式: ``` .... componentProps: { dataSource: [ { title: 'Test01', key: '0', disabled: false, description: 'description 01' }, { title: 'Test02', key: '1', disabled: false, description: 'description 02' }, { title: 'Test03', key: '2', disabled: false, description: 'description 03' }, { title: 'Test04', key: '3', disabled: false, description: 'description 04' }, { title: 'Test05', key: '4', disabled: false, description: 'description 05' }, ], }, .... ```
2022-07-10 18:26:39 +08:00
<div :key="route.name">
<component :is="Component" :key="route.fullPath" />
</div>
</keep-alive>
添加 Form ApiTransfer , 修复标签页切换灰屏不显示内容问题 (#2052) * Table BasicColumn 添加 editDynamicDisabled Co-authored-by: Cyrus Zhou <6802207@qq.com> 使用方式同 Form FormSchema dynamicDisabled ``` export const Columns: BasicColumn[] = [ { title: 'Title', dataIndex: 'Title', editRow: true, editComponent: 'Select', editDynamicDisabled: ({ record }) => record.isDisabled, }, * editComponentProps onChange 功能恢复 Co-authored-by: Cyrus Zhou <6802207@qq.com> 说明: ...omit(compProps, 'onChange') 这会忽略 onChange ,导致 editComponentProps onChange 被取消 如下功能将不支持: ``` editComponentProps: ({ record }) => { return { options: effectTypeData, onChange: () => { }, }; }, ``` * tableData == null 报错 * ApiSelect 第一次选择触发required错误提示问题 * 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值 * 修复标签页切换灰屏不显示内容问题 Co-authored-by: Cyrus Zhou <6802207@qq.com> 问题描述页面没有用 div 包括 会提示 Component inside <Transition> renders non-element root node that cannot be animated , 导致页灰屏必须刷新页面才可以显示内容 * 添加 Form ApiTransfer ## 使用方式 api 方式: ``` ...... component: 'ApiTransfer', componentProps: { api: sysUserSelector, labelField: 'name', valueField: 'id', }, ..... ``` 数据方式: ``` .... componentProps: { dataSource: [ { title: 'Test01', key: '0', disabled: false, description: 'description 01' }, { title: 'Test02', key: '1', disabled: false, description: 'description 02' }, { title: 'Test03', key: '2', disabled: false, description: 'description 03' }, { title: 'Test04', key: '3', disabled: false, description: 'description 04' }, { title: 'Test05', key: '4', disabled: false, description: 'description 05' }, ], }, .... ```
2022-07-10 18:26:39 +08:00
<div v-else :key="route.name">
<component :is="Component" :key="route.fullPath" />
</div>
</transition>
</template>
</RouterView>
<FrameLayout v-if="getCanEmbedIFramePage" />
2021-01-09 23:28:52 +08:00
</template>
<script lang="ts">
import { computed, defineComponent, unref } from 'vue';
import FrameLayout from '/@/layouts/iframe/index.vue';
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting';
import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting';
import { getTransitionName } from './transition';
2021-04-10 19:25:49 +08:00
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
2021-01-09 23:28:52 +08:00
export default defineComponent({
name: 'PageLayout',
components: { FrameLayout },
setup() {
const { getShowMultipleTab } = useMultipleTabSetting();
2021-04-10 19:25:49 +08:00
const tabStore = useMultipleTabStore();
2021-01-09 23:28:52 +08:00
const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting();
const { getBasicTransition, getEnableTransition } = useTransitionSetting();
const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab));
const getCaches = computed((): string[] => {
if (!unref(getOpenKeepAlive)) {
return [];
}
2021-04-10 19:25:49 +08:00
return tabStore.getCachedTabList;
});
2021-01-09 23:28:52 +08:00
return {
getTransitionName,
openCache,
getEnableTransition,
getBasicTransition,
getCaches,
getCanEmbedIFramePage,
};
},
});
</script>