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
9c0ca31f
Commit
9c0ca31f
authored
Jul 16, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement: 选择题库页面滚动
parent
5263292f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
selectCategory.vue
src/pages/learn/selectCategory.vue
+29
-5
No files found.
src/pages/learn/selectCategory.vue
View file @
9c0ca31f
...
...
@@ -15,7 +15,17 @@
:scroll-into-view=
"scrollId"
>
<view
v-for=
"(items, key) in labels"
:key=
"key"
class=
"label-list"
>
<view
v-for=
"(list, index) in items"
:key=
"index"
class=
"label-list"
>
<view
v-for=
"(list, index) in items"
:key=
"index"
class=
"label-list"
:style=
"
{
'min-height':
key == secondKey
&&
index + 1 == list.length
? minHeight + 'px'
: 0,
}"
>
<view
class=
"label-title"
:id=
"key + index"
>
<!-- 品类title -->
<view>
{{
...
...
@@ -33,7 +43,7 @@
wide: key == secondKey,
},
]"
@click="handleClick(key, ind, label)"
@click="handleClick(key, ind
ex, ind
, label)"
>
<text
class=
"label-text"
>
{{
label
.
name
}}
</text>
</view>
...
...
@@ -67,6 +77,7 @@ export default {
},
tapLoading
:
true
,
scrollId
:
''
,
minHeight
:
0
,
}
},
computed
:
{
...
...
@@ -82,13 +93,26 @@ export default {
},
methods
:
{
// 选中标签
handleClick
(
key
,
ind
,
label
)
{
handleClick
(
key
,
ind
ex
,
ind
,
label
)
{
this
.
selected
[
key
]
=
label
if
(
key
==
key1
)
{
// 选中一级标签
this
.
scrollId
=
key2
+
ind
this
.
scrollId
=
''
this
.
selected
[
key2
]
=
{}
const
query
=
uni
.
createSelectorQuery
().
in
(
this
)
query
.
select
(
'.select-category-content'
)
.
boundingClientRect
((
data
)
=>
{
this
.
minHeight
=
data
.
height
-
22
// 去掉margin、padding
this
.
$nextTick
(()
=>
{
this
.
scrollId
=
key2
+
ind
console
.
log
(
this
.
scrollId
)
})
})
.
exec
()
}
else
{
// 选中二级标签
this
.
selected
[
key1
]
=
this
.
labels
[
key1
][
0
][
index
]
this
.
setPageInfo
(
this
.
selected
)
this
.
$u
.
route
({
url
:
'pages/learn/addExam'
,
...
...
@@ -200,7 +224,7 @@ export default {
background-size
:
100%
520rpx
;
background-repeat
:
no-repeat
;
.select-category-content
{
padding
:
0
0
30
rpx
24rpx
;
padding
:
0
0
24
rpx
24rpx
;
height
:
100%
;
overflow
:
auto
;
position
:
relative
;
...
...
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