mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components):[time-picker] add parseFloat to resolve TimePicker offset (#12837)
* fix(components): add parseFloat to resolve TimePicker offset Height is calculated using offsetHeight, offsetHeight will be rounded off closed #12835 * fix(components): import getStyle to optimize the code closed #12835 * Delete useless statements * add judgment * Update basic-time-spinner.vue
This commit is contained in:
@@ -85,6 +85,7 @@ import ElScrollbar from '@element-plus/components/scrollbar'
|
||||
import ElIcon from '@element-plus/components/icon'
|
||||
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
||||
import { useNamespace } from '@element-plus/hooks'
|
||||
import { getStyle } from '@element-plus/utils'
|
||||
import { timeUnits } from '../constants'
|
||||
import { buildTimeList } from '../utils'
|
||||
import { basicTimeSpinnerProps } from '../props/basic-time-spinner'
|
||||
@@ -212,7 +213,11 @@ const adjustSpinner = (type: TimeUnit, value: number) => {
|
||||
|
||||
const typeItemHeight = (type: TimeUnit): number => {
|
||||
const scrollbar = unref(listRefsMap[type])
|
||||
return scrollbar?.$el.querySelector('li').offsetHeight || 0
|
||||
const listItem = scrollbar?.$el.querySelector('li')
|
||||
if (listItem) {
|
||||
return Number.parseFloat(getStyle(listItem, 'height')) || 0
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
const onIncrement = () => {
|
||||
|
||||
Reference in New Issue
Block a user