热门搜索排除空值

This commit is contained in:
Jason
2022-09-29 15:18:41 +08:00
parent c073cc65a7
commit 061543a191
3 changed files with 23 additions and 16 deletions

View File

@@ -219,7 +219,7 @@
size="default"
:value="item.name"
width="400px"
:limit="20"
:limit="50"
show-limit
teleported
>
@@ -269,7 +269,7 @@
size="default"
:value="row.name"
width="400px"
:limit="20"
:limit="50"
show-limit
teleported
>

View File

@@ -27,7 +27,13 @@
<el-table size="large" :data="formData.list">
<el-table-column label="关键词" prop="describe" min-width="200">
<template #default="{ row }">
<el-input v-model="row.name" clearable maxlength="30" />
<el-input
v-model.trim="row.name"
clearable
placeholder="请输入关键字"
show-word-limit
maxlength="30"
/>
</template>
</el-table-column>
<el-table-column label="排序" prop="describe" min-width="80">
@@ -92,7 +98,7 @@ const formData = reactive<Search>({
})
const list = computed(() => {
return [...formData.list].sort((v1, v2) => v2.sort - v1.sort)
return formData.list.filter((item) => item.name).sort((v1, v2) => v2.sort - v1.sort)
})
// 获取登录注册数据
@@ -110,7 +116,7 @@ const getData = async () => {
const handleAdd = () => {
formData.list.push({
name: '关键字',
name: '',
sort: 0
})
}