Skip to content

Commit 66946e7

Browse files
committed
介接sidebar選單資訊
1 parent 4d3f778 commit 66946e7

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/components/Sidebar.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
:default-openeds="['1']"
88
active-text-color="#ffd04b"
99
>
10-
<el-menu-item index="1" class="text-white hover:bg-gray-600">
11-
<span>qwe</span>
12-
</el-menu-item>
13-
<el-menu-item index="2" class="text-white hover:bg-gray-600">
14-
<span>asd</span>
10+
<el-menu-item @click="$emit('getTableData', name)" v-for="(name, index) in sidebarList" :index="(index + 1).toString()" :key="name" class="text-white hover:bg-gray-600">
11+
<span>{{ name }}</span>
1512
</el-menu-item>
1613
</el-menu>
1714
<el-button @click="$emit('singOut')" type="primary" class="w-full bg-gray-600 hover:bg-gray-500 border-gray-600 hover:border-gray-500 rounded-none">
@@ -25,9 +22,13 @@
2522
sidebarOpen: {
2623
type: Boolean,
2724
default: true
25+
},
26+
sidebarList: {
27+
type: Array,
28+
default: () => []
2829
}
2930
})
30-
defineEmits(['singOut'])
31+
defineEmits(['singOut', 'getTableData'])
3132
</script>
3233

3334
<style scoped>

src/composables/apis.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ const tableNames = async () => {
2020
return res
2121
}
2222

23-
export { login, logout, checkLoginStatus, tableNames }
23+
const modelData = async (name) => {
24+
const res = await GET('/private/models')
25+
return res
26+
}
27+
28+
export { login, logout, checkLoginStatus, tableNames, modelData }

src/views/HomeView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<main>
33
<el-container class="h-screen">
4-
<Sidebar :sidebarOpen="sidebarOpen" @singOut="singOut"/>
4+
<Sidebar :sidebarOpen="sidebarOpen" @singOut="singOut" :sidebarList="sidebarList" @getTableData="getTableData"/>
55
<el-container>
66
<el-header class="bg-white border-b flex items-center justify-between md:justify-end">
77
<el-icon @click="toggleSidebar" class="text-black block md:hidden cursor-pointer"><Menu /></el-icon>

0 commit comments

Comments
 (0)