-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(picker): fix custom height problem (#1576)
* fix(picker): fix custom height problem deleted unexpected reset of itemHeight in initScrollParams(), changed the positioning of the indicator to a dynamic value based on --td-picker-item-height; Added a demo of using custom height fix #1207 * chore: update common * chore: update snapshot * fix(picker): auto mediate indicator * chore: update common --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c5d5d2d
commit 2827c67
Showing
5 changed files
with
132 additions
and
10 deletions.
There are no files selected for viewing
Submodule _common
updated
21 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script setup lang="ts"> | ||
import { reactive } from 'vue'; | ||
import { PickerValue } from 'tdesign-mobile-vue'; | ||
const cityOptions = () => { | ||
return [ | ||
{ | ||
label: '北京市', | ||
value: '北京市', | ||
}, | ||
{ | ||
label: '上海市', | ||
value: '上海市', | ||
}, | ||
{ | ||
label: '广州市', | ||
value: '广州市', | ||
}, | ||
{ | ||
label: '深圳市', | ||
value: '深圳市', | ||
}, | ||
{ | ||
label: '杭州市', | ||
value: '杭州市', | ||
}, | ||
{ | ||
label: '成都市', | ||
value: '成都市', | ||
}, | ||
{ | ||
label: '长沙市', | ||
value: '长沙市', | ||
}, | ||
]; | ||
}; | ||
const cityState = reactive({ | ||
show: false, | ||
city: [], | ||
}); | ||
const onConfirm = (val: string[], context: number[]) => { | ||
console.log(val); | ||
console.log('context', context); | ||
cityState.show = false; | ||
}; | ||
const onPick = (value: PickerValue[], context: any) => { | ||
console.log('value', value); | ||
console.log('context', context); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<t-cell arrow title="自定义高度选择器" :note="cityState.city.join(' ')" @click="cityState.show = true" /> | ||
<t-popup v-if="cityState.show" v-model="cityState.show" class="picker-custom-height-demo" placement="bottom"> | ||
<t-picker | ||
v-model="cityState.city" | ||
:columns="cityOptions" | ||
@confirm="onConfirm" | ||
@cancel="cityState.show = false" | ||
@pick="onPick" | ||
/> | ||
</t-popup> | ||
</template> | ||
|
||
<style lang="less"> | ||
.picker-custom-height-demo { | ||
--td-picker-item-height: 80px; | ||
--td-picker-group-height: 400px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters