From 2da5b47b08c05e3e335f3ba599904f2501c49a93 Mon Sep 17 00:00:00 2001 From: pengsl <18718574603@163.com> Date: Sun, 13 Sep 2020 23:56:26 +0800 Subject: [PATCH] fix: indexes in weapp --- .../taro-ui-vue/src/components/indexes/index.ts | 13 +++++++++++-- .../taro-ui-vue/src/components/indexes/index.vue | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/taro-ui-vue/src/components/indexes/index.ts b/packages/taro-ui-vue/src/components/indexes/index.ts index 7716f19..c491010 100644 --- a/packages/taro-ui-vue/src/components/indexes/index.ts +++ b/packages/taro-ui-vue/src/components/indexes/index.ts @@ -27,7 +27,7 @@ export default { }, isVibrate: { type: Boolean, - default: true, + default: false, }, isShowToast: { type: Boolean, @@ -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 @@ -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({ diff --git a/packages/taro-ui-vue/src/components/indexes/index.vue b/packages/taro-ui-vue/src/components/indexes/index.vue index b16a0f5..def3f89 100644 --- a/packages/taro-ui-vue/src/components/indexes/index.vue +++ b/packages/taro-ui-vue/src/components/indexes/index.vue @@ -29,7 +29,7 @@