Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
fix: indexes in weapp
Browse files Browse the repository at this point in the history
  • Loading branch information
psaren committed Sep 13, 2020
1 parent a876640 commit cee38fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/taro-ui-vue/src/components/indexes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export default {
Taro.vibrateShort()
}
},
initData() {
getItemHeight () {
delayQuerySelector(this, '.at-indexes__menu').then((rect) => {
const arr = [...rect, { top: 0, height: 0 }]
const len = this.list.length
Expand All @@ -199,6 +199,15 @@ export default {
this.itemHeight = Math.floor(this.menuHeight / (len + 1))
})
},
initData() {
if (this.isWeb) {
this.getItemHeight()
} else {
setTimeout(() => {
this.getItemHeight()
}, 100)
}
},
handleScroll(e) {
if (e && e.detail) {
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-ui-vue/src/components/indexes/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<scroll-view
:id="listId"
class="at-indexes__body"
scroll-y
:scroll-y="true"
:scroll-with-animation="animation"
:scroll-top="isWEB ? state._scrollTop : undefined"
:scroll-into-view="!isWEB ? state._scrollIntoView : ''"
Expand Down

0 comments on commit cee38fa

Please sign in to comment.