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

Update Create.vue

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