Files
element-plus/packages/components/scrollbar/src/scrollbar.ts
三咲智子 6503e55277 refactor(utils): migrate utils (#5949)
* refactor(utils-v2): migrate utils

* refactor(utils-v2): migrate utils

* refactor(utils-v2): migrate utils

* refactor(utils): remove

* refactor(utils): rename

* refactor(utils): move EVENT_CODE to constants

* refactor: remove generic
2022-02-11 11:03:15 +08:00

60 lines
1.2 KiB
TypeScript

import { buildProps, definePropType, isNumber } from '@element-plus/utils'
import type { StyleValue, ExtractPropTypes } from 'vue'
export const scrollbarProps = buildProps({
height: {
type: [String, Number],
default: '',
},
maxHeight: {
type: [String, Number],
default: '',
},
native: {
type: Boolean,
default: false,
},
wrapStyle: {
type: definePropType<StyleValue>([String, Object, Array]),
default: '',
},
wrapClass: {
type: [String, Array],
default: '',
},
viewClass: {
type: [String, Array],
default: '',
},
viewStyle: {
type: [String, Array],
default: '',
},
noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
tag: {
type: String,
default: 'div',
},
always: {
type: Boolean,
default: false,
},
minSize: {
type: Number,
default: 20,
},
} as const)
export type ScrollbarProps = ExtractPropTypes<typeof scrollbarProps>
export const scrollbarEmits = {
scroll: ({
scrollTop,
scrollLeft,
}: {
scrollTop: number
scrollLeft: number
}) => isNumber(scrollTop) && isNumber(scrollLeft),
}
export type ScrollbarEmits = typeof scrollbarEmits