diff --git a/packages/varlet-ui/src/picker/Picker.vue b/packages/varlet-ui/src/picker/Picker.vue index 34e2d3ae744..19c45224b2d 100644 --- a/packages/varlet-ui/src/picker/Picker.vue +++ b/packages/varlet-ui/src/picker/Picker.vue @@ -15,17 +15,17 @@ show, 'onUpdate:show': handlePopupUpdateShow, position: 'bottom', - class: 'var-picker__popup', + class: n('popup'), } : null " var-picker-cover > -
-
+
+
-
{{ dt(title, pack.pickerTitle) }}
+
{{ dt(title, pack.pickerTitle) }}
-
+
-
-
{{ t }}
+
+
{{ t }}
-
+
@@ -102,6 +97,7 @@ import { pack } from '../locale' import type { Ref, ComputedRef, ComponentPublicInstance } from 'vue' import type { CascadeColumn, NormalColumn } from './props' import type { Texts } from './index' +import { createNamespace, call } from '../utils/components' export interface ScrollColumn { id: number @@ -118,6 +114,8 @@ export interface ScrollColumn { scrollEl: HTMLElement | null } +const { n, classes } = createNamespace('picker') + const MOMENTUM_RECORD_TIME = 300 const MOMENTUM_ALLOW_DISTANCE = 15 @@ -146,7 +144,7 @@ export default defineComponent({ } const handlePopupUpdateShow = (value: boolean) => { - props['onUpdate:show']?.(value) + call(props['onUpdate:show'], value) } const limitTranslate = (scrollColumn: ScrollColumn) => { @@ -322,7 +320,7 @@ export default defineComponent({ } prevIndexes = [...indexes] - onChange?.(texts, indexes) + call(onChange, texts, indexes) } const stopScroll = () => { @@ -350,7 +348,7 @@ export default defineComponent({ const { texts, indexes } = getPicked() prevIndexes = [...indexes] - props.onConfirm?.(texts, indexes) + call(props.onConfirm, texts, indexes) } // expose @@ -359,7 +357,7 @@ export default defineComponent({ const { texts, indexes } = getPicked() prevIndexes = [...indexes] - props.onCancel?.(texts, indexes) + call(props.onCancel, texts, indexes) } watch( @@ -376,6 +374,8 @@ export default defineComponent({ ) return { + n, + classes, pack, optionHeight, optionCount,