提交 248eb798 编写于 作者: View Design's avatar View Design

Update Create.vue

上级 7083fa8b
......@@ -13,7 +13,7 @@
<div class="flex justify-between">
<USelectMenu
v-model="selectedRepo"
:options="repos"
:options="$repos"
placeholder="选择 GitHub 项目"
value-attribute="label"
option-attribute="label"
......@@ -31,12 +31,11 @@
</div>
</template>
<script setup>
const { $setRepo } = useReposStore()
const { $setRepo, $repos } = useReposStore()
const { fetchRequest } = useFetchRequest()
const emits = defineEmits([ 'search' ])
const query = ref('')
const selectedRepo = ref('keycloak')
const repos = ref([])
const loading = ref(false)
const handleSearch = async () => {
if (loading.value || query.value === '') return
......@@ -56,19 +55,19 @@ const handleSearch = async () => {
}
}
const repoData = await fetchRequest('/v1/chat/repository', {
let repoData = await fetchRequest('/v1/chat/repository', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
repos.value = repoData.data.map(item => {
repoData = repoData.data.map(item => {
return {
label: item.name,
url: item.path,
branch: item.branch
}
})
$setRepo(repos.value)
$setRepo(repoData)
defineShortcuts({
meta_enter: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册