Skip to content

Commit

Permalink
fix: 修复picker 在h5中适配错误
Browse files Browse the repository at this point in the history
  • Loading branch information
yang1206 committed Jul 7, 2023
1 parent af87d68 commit cdd9aa4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/nutui/components/picker/index.scss
@@ -1,3 +1,5 @@
@import '../pickercolumn/index';

.nut-theme-dark {
.nut-picker {
position: relative;
Expand Down
14 changes: 8 additions & 6 deletions packages/nutui/components/picker/picker.vue
Expand Up @@ -221,8 +221,8 @@ export default defineComponent({
<slot name="top" />

<!-- Taro 下转换成 微信小程序 -->
<!-- #ifndef H5 -->
<picker-view
v-if="!isH5"
:indicator-style="`height:${optionHeight}px`"
:value="defaultIndexes"
:style="pickerViewStyles"
Expand All @@ -244,9 +244,11 @@ export default defineComponent({
</view>
</picker-view-column>
</picker-view>
<!-- #endif -->

<!-- Taro 下转换成 H5 -->
<view v-else class="nut-picker__column" :style="columnStyle">
<!-- #ifdef H5 -->
<view class="nut-picker__column" :style="columnStyle">
<view v-for="(column, columnIndex) in columnsList" :key="columnIndex" class="nut-picker__columnitem">
<NutPickerColumn
:ref="swipeRef"
Expand All @@ -257,14 +259,14 @@ export default defineComponent({
:swipe-duration="swipeDuration"
:visible-option-num="visibleOptionNum"
:option-height="optionHeight"
@change="
(option:PickerOption) => {
changeHandler(columnIndex, option);
}
@change="(option: PickerOption) => {
changeHandler(columnIndex, option);
}
"
/>
</view>
</view>
<!-- #endif -->
<slot name="default" />
</view>
</template>
Expand Down

0 comments on commit cdd9aa4

Please sign in to comment.