mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 08:17:33 +00:00
feat: add menus tree
This commit is contained in:
parent
4c1a8fef9d
commit
3eba89d2c1
@ -34,7 +34,7 @@ export const routesMarketplace: Array<RouteRecordRaw> = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: "menus",
|
title: "menus",
|
||||||
},
|
},
|
||||||
component: () => import("@/views/administration/Menus.vue"),
|
component: () => import("@/views/marketplace/Menus.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/marketplace/settings",
|
path: "/marketplace/settings",
|
||||||
@ -42,7 +42,7 @@ export const routesMarketplace: Array<RouteRecordRaw> = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: "settings",
|
title: "settings",
|
||||||
},
|
},
|
||||||
component: () => import("@/views/administration/Settings.vue"),
|
component: () => import("@/views/marketplace/Settings.vue"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
1
src/types/components.d.ts
vendored
1
src/types/components.d.ts
vendored
@ -35,6 +35,7 @@ declare module '@vue/runtime-core' {
|
|||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
|
ElTree: typeof import('element-plus/es')['ElTree']
|
||||||
Graph: typeof import('./../components/Graph.vue')['default']
|
Graph: typeof import('./../components/Graph.vue')['default']
|
||||||
Icon: typeof import('./../components/Icon.vue')['default']
|
Icon: typeof import('./../components/Icon.vue')['default']
|
||||||
Loading: typeof import('element-plus/es')['ElLoadingDirective']
|
Loading: typeof import('element-plus/es')['ElLoadingDirective']
|
||||||
|
@ -13,20 +13,48 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="menus flex-v"> menus </div>
|
<div class="menus flex-v">
|
||||||
|
<el-tree
|
||||||
|
:data="menus"
|
||||||
|
show-checkbox
|
||||||
|
node-key="id"
|
||||||
|
:default-expanded-keys="[2, 3]"
|
||||||
|
:default-checked-keys="[5]"
|
||||||
|
:props="defaultProps"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { ref } from "vue";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
|
||||||
const appStore = useAppStoreWithOut();
|
const appStore = useAppStoreWithOut();
|
||||||
|
const menus = ref<any[]>([]);
|
||||||
|
const expandedKeys = ref<string[]>([]);
|
||||||
|
const checkedKeys = ref<string[]>([]);
|
||||||
|
const defaultProps = {
|
||||||
|
children: "subItems",
|
||||||
|
label: "title",
|
||||||
|
};
|
||||||
|
|
||||||
appStore.setPageTitle("Menus");
|
appStore.setPageTitle("Menus");
|
||||||
getMenus();
|
getMenus();
|
||||||
|
|
||||||
async function getMenus() {
|
async function getMenus() {
|
||||||
const resp = await appStore.queryMenuItems();
|
const resp = (await appStore.queryMenuItems()) || {};
|
||||||
const menus = resp.getMenuItems;
|
menus.value = (resp.getMenuItems || []).map((d: any, index: number) => {
|
||||||
console.log(menus);
|
d.id = String(index);
|
||||||
|
expandedKeys.value.push(d.id);
|
||||||
|
checkedKeys.value.push(d.id);
|
||||||
|
d.subItem = d.subItems.map((item: any, subIndex: number) => {
|
||||||
|
item.id = `${index} + ${subIndex}`;
|
||||||
|
expandedKeys.value.push(item.id);
|
||||||
|
checkedKeys.value.push(item.id);
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
console.log(menus.value);
|
||||||
}
|
}
|
||||||
// window.localStorage.setItem("menus", lang.value);
|
// window.localStorage.setItem("menus", lang.value);
|
||||||
</script>
|
</script>
|
||||||
@ -35,5 +63,6 @@ limitations under the License. -->
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-size: $font-size-smaller;
|
font-size: $font-size-smaller;
|
||||||
|
padding: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user