mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix(projects): 修复页面缓存
This commit is contained in:
@ -3,7 +3,19 @@ import useContext from './useContext';
|
||||
import useRouterChange from './useRouterChange';
|
||||
import useRouteParam from './useRouteParam';
|
||||
import useRouteQuery from './useRouteQuery';
|
||||
import useRouteProps from './useRouteProps';
|
||||
import useBoolean from './useBoolean';
|
||||
import useLoading from './useLoading';
|
||||
import useScrollBehavior from './useScrollBehavior';
|
||||
|
||||
export { useAppTitle, useContext, useRouterChange, useRouteParam, useRouteQuery, useBoolean, useLoading };
|
||||
export {
|
||||
useAppTitle,
|
||||
useContext,
|
||||
useRouterChange,
|
||||
useRouteParam,
|
||||
useRouteQuery,
|
||||
useRouteProps,
|
||||
useBoolean,
|
||||
useLoading,
|
||||
useScrollBehavior
|
||||
};
|
||||
|
22
src/hooks/common/useRouteProps.ts
Normal file
22
src/hooks/common/useRouteProps.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
export default function useRouteProps() {
|
||||
const route = useRoute();
|
||||
const props = computed(() => {
|
||||
/** 路由名称 */
|
||||
const name = route.name as string;
|
||||
/** 混存页面 */
|
||||
const keepAlive = Boolean(route.meta?.keepAlive);
|
||||
/** 视高100% */
|
||||
const fullPage = Boolean(route.meta?.fullPage);
|
||||
|
||||
return {
|
||||
name,
|
||||
keepAlive,
|
||||
fullPage
|
||||
};
|
||||
});
|
||||
|
||||
return props;
|
||||
}
|
16
src/hooks/common/useScrollBehavior.ts
Normal file
16
src/hooks/common/useScrollBehavior.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
/** 滚动行为 */
|
||||
export default function useScrollBehavior() {
|
||||
const scrollbar = ref<HTMLElement | null>(null);
|
||||
|
||||
/** 重置滚动条行为 */
|
||||
function resetScrollBehavior() {
|
||||
scrollbar.value?.scrollTo({ left: 0, top: 0 });
|
||||
}
|
||||
|
||||
return {
|
||||
scrollbar,
|
||||
resetScrollBehavior
|
||||
};
|
||||
}
|
@ -4,7 +4,9 @@ export {
|
||||
useRouterChange,
|
||||
useRouteParam,
|
||||
useRouteQuery,
|
||||
useRouteProps,
|
||||
useBoolean,
|
||||
useLoading
|
||||
useLoading,
|
||||
useScrollBehavior
|
||||
} from './common';
|
||||
export { useCountDown, useSmsCode } from './business';
|
||||
|
Reference in New Issue
Block a user