fix: 修复issue
This commit is contained in:
@@ -3,11 +3,6 @@
|
||||
<slot name="title"></slot>
|
||||
<d-form :layout="props.layout" :label-align="'end'">
|
||||
<d-row :gutter="16">
|
||||
<d-col :span="8">
|
||||
<d-form-item field="license" label="license">
|
||||
<d-input placeholder="请输入license名称" v-model="formData.licenseName"/>
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
<d-col :span="8">
|
||||
<d-form-item field="name" label="软件/组件名称">
|
||||
<d-input placeholder="请输入软件/组件名称" v-model="formData.searchWord"/>
|
||||
@@ -18,6 +13,11 @@
|
||||
<d-input v-model="formData.softwareVersion"/>
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
<d-col :span="8">
|
||||
<d-form-item field="license" label="license">
|
||||
<d-input placeholder="请输入license名称" v-model="formData.licenseName"/>
|
||||
</d-form-item>
|
||||
</d-col>
|
||||
</d-row>
|
||||
<d-row :gutter="16">
|
||||
<d-col :span="8">
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, defineEmits, defineProps, watch } from 'vue';
|
||||
import { searchLanguageList } from '@/api/jyh'
|
||||
|
||||
const props = defineProps({
|
||||
layout: {
|
||||
type: String,
|
||||
@@ -100,32 +102,11 @@ const cancel = () => {
|
||||
emit('update:modelValue', formData.value);
|
||||
}
|
||||
|
||||
const getLanguageList = () => {
|
||||
const mockData = [
|
||||
{
|
||||
"key": "c++",
|
||||
"name": "C++"
|
||||
},
|
||||
{
|
||||
"key": "C",
|
||||
"name": "C"
|
||||
},
|
||||
{
|
||||
"key": "PYTHON",
|
||||
"name": "PYTHON"
|
||||
},
|
||||
{
|
||||
"key": "JAVA",
|
||||
"name": "JAVA"
|
||||
}
|
||||
]
|
||||
|
||||
languageList.value = mockData.map(item => {
|
||||
return {
|
||||
name: item.name,
|
||||
value: item.key
|
||||
}
|
||||
})
|
||||
const getLanguageList = async() => {
|
||||
const res: any = await searchLanguageList();
|
||||
if (!res.error) {
|
||||
languageList.value = res.data.data;
|
||||
}
|
||||
}
|
||||
getLanguageList();
|
||||
</script>
|
||||
|
||||
@@ -3,7 +3,30 @@
|
||||
:key="$route.path + $route.query?.val" id="golbalSearch" class="g-header-search"
|
||||
v-model.trim="searchStr" placeholder="输入搜索内容..." @keyup.enter="search" @clear="handleClear" clearable >
|
||||
<template #prepend>
|
||||
<d-select v-model="searchType" :options="options"></d-select>
|
||||
<d-dropdown @toggle="onCateToggle($event)">
|
||||
<div class="flex items-center gap-1 cursor-pointer">
|
||||
{{ searchType }}
|
||||
<d-icon :rotate="cateRotate" name="icon-chevron-down-2"></d-icon>
|
||||
</div>
|
||||
<template #menu>
|
||||
<ul class="list-menu">
|
||||
<li class="menu-item" @click="onCategoryChange('组件/软件')">组件/软件</li>
|
||||
<d-dropdown :position="position" :offset="0">
|
||||
<li class="menu-item">
|
||||
行业
|
||||
<i class="icon icon-chevron-right"></i>
|
||||
</li>
|
||||
<template #menu>
|
||||
<ul class="list-menu">
|
||||
<li class="menu-item" v-for="option in industryOptions" @click="onCategoryChange(option)">
|
||||
{{ option }}
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</d-dropdown>
|
||||
</ul>
|
||||
</template>
|
||||
</d-dropdown>
|
||||
</template>
|
||||
<template #append>
|
||||
<d-icon @click="search" name="search" style="font-size: inherit;" />
|
||||
@@ -19,11 +42,16 @@ import microApp from '@micro-zoe/micro-app';
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const searchStr = ref(route?.query?.val || '');
|
||||
const searchType = ref('License');
|
||||
const options = reactive(['License']);
|
||||
const searchType = ref('组件/软件');
|
||||
const position = ref(['right-start', 'right-end']);
|
||||
const industryOptions = ref(['通信', '军工', '金融', '能源']);
|
||||
|
||||
const placeholder = ref('「开搜」:一搜即达,开发者的AI搜索');
|
||||
|
||||
const onCategoryChange = (event) => {
|
||||
searchType.value = event;
|
||||
}
|
||||
|
||||
const search = () => {
|
||||
if (!searchStr.value) {
|
||||
document.querySelector('#golbalSearch').blur();
|
||||
@@ -81,4 +109,23 @@ onUnmounted(() => {
|
||||
width: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 4px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: var(--devui-list-item-hover-bg, #f2f5fc);
|
||||
color: var(--devui-list-item-hover-text, #526ecc);
|
||||
}
|
||||
}
|
||||
|
||||
.list-menu {
|
||||
padding: 8px;
|
||||
margin: 0;
|
||||
width: 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user