feat(projects): 添加多页签右键菜单

This commit is contained in:
Soybean
2021-09-20 18:55:42 +08:00
parent 3cfa0f103c
commit d6f5237c8c
33 changed files with 362 additions and 168 deletions

View File

@ -14,16 +14,14 @@ export default function useReloadContext() {
function handleReload() {
reload.value = false;
nextTick(() => {
nextTick(() => {
reload.value = true;
});
reload.value = true;
});
}
const context: ReloadContext = {
reload,
handleReload
};
function useReloadProvide() {
useProvide(context);
}

View File

@ -1,3 +1 @@
export { setupAppContext, useReloadInject } from './app';
export { useHoverIndexProvide, useHoverIndexInject } from './part';

View File

@ -1,5 +0,0 @@
import useHoverIndexContext from './useHoverIndexContext';
const { useHoverIndexProvide, useHoverIndexInject } = useHoverIndexContext();
export { useHoverIndexProvide, useHoverIndexInject };

View File

@ -1,39 +0,0 @@
import { ref } from 'vue';
import type { Ref } from 'vue';
import { useContext } from '@/hooks';
interface HoverIndexContext {
/** 被悬浮元素索引 */
index: Ref<number>;
/** 设置索引 */
setHoverIndex(index: number): void;
/** 重置索引 */
resetHoverIndex(): void;
}
const { useProvide, useInject: useHoverIndexInject } = useContext<HoverIndexContext>();
/** 获取被悬浮元素的索引上下文 */
export default function useHoverIndexContext() {
const index = ref(-1);
function setHoverIndex(hIndex: number) {
index.value = hIndex;
}
function resetHoverIndex() {
index.value = -1;
}
const context: HoverIndexContext = {
index,
setHoverIndex,
resetHoverIndex
};
function useHoverIndexProvide() {
useProvide(context);
}
return {
context,
useHoverIndexProvide,
useHoverIndexInject
};
}