Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
study
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Damon
study
Commits
56a02ffb
Commit
56a02ffb
authored
Jul 27, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 搜索
parent
71f25dcf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
detail.vue
src/pages/search/detail.vue
+2
-1
index.vue
src/pages/search/index.vue
+9
-10
No files found.
src/pages/search/detail.vue
View file @
56a02ffb
...
@@ -178,12 +178,13 @@ export default {
...
@@ -178,12 +178,13 @@ export default {
search
(
val
)
{
search
(
val
)
{
if
(
val
){
if
(
val
){
this
.
keyword
=
val
this
.
keyword
=
val
let
history
=
this
.
searchHistory
let
history
=
this
.
searchHistory
.
filter
(
v
=>
v
!==
val
)
history
.
unshift
(
val
)
history
.
unshift
(
val
)
if
(
history
.
length
>
9
)
{
if
(
history
.
length
>
9
)
{
history
.
splice
(
9
,
1
)
history
.
splice
(
9
,
1
)
}
}
this
.
$u
.
vuex
(
'searchHistory'
,
history
)
this
.
$u
.
vuex
(
'searchHistory'
,
history
)
this
.
init
()
}
}
},
},
collection
(
item
)
{
collection
(
item
)
{
...
...
src/pages/search/index.vue
View file @
56a02ffb
...
@@ -43,8 +43,7 @@
...
@@ -43,8 +43,7 @@
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
keyword
:
''
,
keyword
:
''
history
:
[],
}
}
},
},
computed
:
{
computed
:
{
...
@@ -56,19 +55,20 @@ export default {
...
@@ -56,19 +55,20 @@ export default {
deleteImg
()
{
deleteImg
()
{
return
process
.
uniEnv
.
qn_base_url
+
'delete.png'
return
process
.
uniEnv
.
qn_base_url
+
'delete.png'
},
},
},
history
()
{
created
()
{
return
this
.
searchHistory
this
.
history
=
this
.
searchHistory
}
},
},
methods
:
{
methods
:
{
search
(
val
)
{
search
(
val
)
{
if
(
val
){
if
(
val
){
this
.
keyword
=
val
this
.
keyword
=
val
this
.
history
.
unshift
(
val
)
let
history
=
this
.
searchHistory
.
filter
(
v
=>
v
!==
val
)
if
(
this
.
history
.
length
>
9
){
history
.
unshift
(
val
)
this
.
history
.
splice
(
9
,
1
)
if
(
history
.
length
>
9
){
history
.
splice
(
9
,
1
)
}
}
this
.
$u
.
vuex
(
'searchHistory'
,
this
.
history
)
this
.
$u
.
vuex
(
'searchHistory'
,
history
)
this
.
toSearchDetail
(
val
)
this
.
toSearchDetail
(
val
)
}
}
},
},
...
@@ -86,7 +86,6 @@ export default {
...
@@ -86,7 +86,6 @@ export default {
content
:
'确认要清空搜索历史记录?'
,
content
:
'确认要清空搜索历史记录?'
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
this
.
history
=
[]
this
.
$u
.
vuex
(
'searchHistory'
,
[])
this
.
$u
.
vuex
(
'searchHistory'
,
[])
}
}
},
},
...
...
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