Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e964e472
authored
May 01, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:【商城】店铺装修-搜索栏:新增热词,出现 object object 的情况
parent
415baa07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
src/components/DiyEditor/components/mobile/SearchBar/property.vue
+15
-1
src/components/Draggable/index.vue
+4
-2
No files found.
src/components/DiyEditor/components/mobile/SearchBar/property.vue
View file @
e964e472
...
...
@@ -3,7 +3,7 @@
<!-- 表单 -->
<el-form
label-width=
"80px"
:model=
"formData"
class=
"m-t-8px"
>
<el-card
header=
"搜索热词"
class=
"property-group"
shadow=
"never"
>
<Draggable
v-model=
"formData.hotKeywords"
:empty-item=
"''"
>
<Draggable
v-model=
"formData.hotKeywords"
:empty-item=
"''"
:min=
"0"
>
<template
#
default=
"
{ index }">
<el-input
v-model=
"formData.hotKeywords[index]"
placeholder=
"请输入热词"
/>
</
template
>
...
...
@@ -61,6 +61,7 @@
<
script
setup
lang=
"ts"
>
import
{
useVModel
}
from
'@vueuse/core'
import
{
SearchProperty
}
from
'@/components/DiyEditor/components/mobile/SearchBar/config'
import
{
isString
}
from
'@/utils/is'
/** 搜索框属性面板 */
defineOptions
({
name
:
'SearchProperty'
})
...
...
@@ -68,6 +69,19 @@ defineOptions({ name: 'SearchProperty' })
const
props
=
defineProps
<
{
modelValue
:
SearchProperty
}
>
()
const
emit
=
defineEmits
([
'update:modelValue'
])
const
formData
=
useVModel
(
props
,
'modelValue'
,
emit
)
// 监听热词数组变化
watch
(
()
=>
formData
.
value
.
hotKeywords
,
(
newVal
)
=>
{
// 找到非字符串项的索引
const
nonStringIndex
=
newVal
.
findIndex
((
item
)
=>
!
isString
(
item
))
if
(
nonStringIndex
!==
-
1
)
{
formData
.
value
.
hotKeywords
[
nonStringIndex
]
=
''
}
},
{
deep
:
true
,
flush
:
'post'
}
)
</
script
>
<
style
scoped
lang=
"scss"
></
style
>
src/components/Draggable/index.vue
View file @
e964e472
...
...
@@ -28,7 +28,7 @@
<Icon
icon=
"ep:delete"
class=
"cursor-pointer text-red-5"
v-if=
"formData.length >
1
"
v-if=
"formData.length >
min
"
@
click=
"handleDelete(index)"
/>
</el-tooltip>
...
...
@@ -69,7 +69,9 @@ const props = defineProps({
// 空的元素:点击添加按钮时,创建元素并添加到列表;默认为空对象
emptyItem
:
any
<
unknown
>
().
def
({}),
// 数量限制:默认为0,表示不限制
limit
:
propTypes
.
number
.
def
(
0
)
limit
:
propTypes
.
number
.
def
(
0
),
// 最小数量:默认为1
min
:
propTypes
.
number
.
def
(
1
)
})
// 定义事件
const
emit
=
defineEmits
([
'update:modelValue'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment