|
1 | 1 | <template>
|
2 | 2 | <div class="min-h-[300px] py-8 md:px-5">
|
3 | 3 | <div class="flex items-center justify-between">
|
4 |
| - <div class="flex items-center flex-wrap"> |
5 |
| - <div class="mr-4"> |
6 |
| - <el-dropdown split-button> |
7 |
| - <svg class="mr-1" xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none"> |
8 |
| - <circle cx="8.75" cy="2.25" r="1.75" stroke="#606266" stroke-linecap="round" stroke-linejoin="round"/> |
9 |
| - <circle cx="3.25" cy="9.5" r="1.75" stroke="#606266" stroke-linecap="round" stroke-linejoin="round"/> |
10 |
| - <path d="M3.25 4L3.25 7.75" stroke="#606266" stroke-linecap="round" stroke-linejoin="round"/> |
11 |
| - <circle cx="3.25" cy="2.25" r="1.75" stroke="#606266" stroke-linecap="round" stroke-linejoin="round"/> |
12 |
| - <path d="M3.25 7.75V7.75C3.25 6.64543 4.14543 5.75 5.25 5.75H7C7.9665 5.75 8.75 4.9665 8.75 4V4" stroke="#606266" stroke-linecap="round" stroke-linejoin="round"/> |
13 |
| - </svg> |
14 |
| - {{ currentBranch }} |
15 |
| - <template #dropdown> |
16 |
| - <el-dropdown-menu> |
17 |
| - <el-dropdown-item v-for="branch in branches" :key="branch.name" @click="$emit('change-branch', branch.name)">{{ branch.name }}</el-dropdown-item> |
18 |
| - </el-dropdown-menu> |
19 |
| - </template> |
20 |
| - </el-dropdown> |
21 |
| - </div> |
| 4 | + <div class="flex items-center flex-wrap gap-4"> |
| 5 | + <BranchDropdown @changeBranch="changeBranch" |
| 6 | + :current-branch="currentBranch" |
| 7 | + :branches="branches" /> |
22 | 8 | <el-breadcrumb separator="/">
|
23 | 9 | <el-breadcrumb-item>
|
24 | 10 | <a :href="`/${prefixPath}/${namespacePath}/files/${currentBranch}`">{{ namespacePath.split('/')[1] }}</a>
|
|
160 | 146 | import { format } from 'timeago.js';
|
161 | 147 | import { ElMessage } from "element-plus"
|
162 | 148 | import { useI18n } from 'vue-i18n'
|
| 149 | + import BranchDropdown from './BranchDropdown.vue'; |
163 | 150 |
|
164 | 151 | const props = defineProps({
|
165 | 152 | branches: Object,
|
|
178 | 165 | const lastCommitAvatar = ref('https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png')
|
179 | 166 | const prefixPath = document.location.pathname.split('/')[1]
|
180 | 167 |
|
| 168 | + const emit = defineEmits(['changeBranch']) |
| 169 | +
|
| 170 | + const changeBranch = (branch) => { |
| 171 | + emit('changeBranch', branch) |
| 172 | + } |
| 173 | +
|
181 | 174 | const extractNameFromPath = (path) => {
|
182 | 175 | const parts = path.split('/')
|
183 | 176 | return parts[parts.length - 1]
|
|
0 commit comments