Skip to content

Commit

Permalink
fix: 🐛 修复 col-picker 组件首次打开指示线位置异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonofweisheng committed Jan 7, 2024
1 parent 3dcfe4e commit 323fb00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ $-color-icon: var(--wot-color-icon, #d9d9d9) !default; // icon颜色
$-color-icon-active: var(--wot-color-icon-active, #eee) !default; // icon颜色hover
$-color-icon-disabled: var(--wot-color-icon-disabled, #a7a7a7) !default; // icon颜色disabled
/* overlay */
$-overlay-bg: rgba(0, 0, 0, 0.65) !default;
$-overlay-bg-dark: rgba(0, 0, 0, 0.75) !default;
$-overlay-bg: var(--wot-overlay-bg, rgba(0, 0, 0, 0.65)) !default;
$-overlay-bg-dark: var(--wot-overlay-bg-dark, rgba(0, 0, 0, 0.75)) !default;


/*----------------------------------------- Theme color. end -------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
:close-on-click-modal="closeOnClickModal"
:z-index="zIndex"
:safe-area-inset-bottom="safeAreaInsetBottom"
@open="handlePickerOpend"
@close="handlePickerClose"
>
<view class="wd-col-picker__selected">
Expand Down Expand Up @@ -217,12 +218,12 @@ watch(
console.error('[wot design] error(wd-col-picker): the columns props of wd-col-picker should be a two-dimensional array')
return
}
if (newValue.length === 0 && !oldValue) return
const newSelectedList = newValue.slice(0)
selectList.value = newSelectedList
selectShowList.value = pickerColSelected.value.map((item, colIndex) => {
return getSelectedItem(item, colIndex, newSelectedList)[props.labelKey]
})
Expand Down Expand Up @@ -317,6 +318,10 @@ function open() {
function close() {
handlePickerClose()
}
function handlePickerOpend() {
updateLineAndScroll(false)
}
function handlePickerClose() {
pickerShow.value = false
// 如果目前用户正在选择,需要在popup关闭时将数据重置回上次数据,popup 关闭时间 250
Expand All @@ -340,9 +345,6 @@ function showPicker() {
pickerShow.value = true
lastPickerColSelected.value = pickerColSelected.value.slice(0)
lastSelectList.value = selectList.value.slice(0)
setTimeout(() => {
updateLineAndScroll()
}, 30)
}
function getSelectedItem(value, colIndex, selectList) {
Expand Down

0 comments on commit 323fb00

Please sign in to comment.