feat(ActionBar): use relation

This commit is contained in:
chenjiahan
2020-08-23 15:11:13 +08:00
parent 1f82bcf5f0
commit ff3a5d66ab
4 changed files with 39 additions and 19 deletions
+3 -2
View File
@@ -16,7 +16,8 @@ export function useParent(key: string) {
export function useChildren(key: string, child: unknown) {
const parent = inject<Parent>(key, null);
const index = computed(() => parent?.children.value.indexOf(child));
const children = parent?.children;
const index = computed(() => children?.value.indexOf(child));
if (parent) {
parent.children.value.push(child);
@@ -24,6 +25,6 @@ export function useChildren(key: string, child: unknown) {
return {
index,
parent,
children,
};
}