fix: virtual list ts error
parent
df771a8fc6
commit
4fc1a3cd78
|
@ -2,7 +2,7 @@ export interface RefObject extends Function {
|
|||
current?: any;
|
||||
}
|
||||
|
||||
function createRef(): RefObject {
|
||||
function createRef(): any {
|
||||
const func: RefObject = (node: any) => {
|
||||
func.current = node;
|
||||
};
|
||||
|
|
|
@ -237,7 +237,6 @@ const SelectSelector = defineComponent<SelectorProps>({
|
|||
onInputMouseDown,
|
||||
onInputCompositionStart,
|
||||
onInputCompositionEnd,
|
||||
choiceTransitionName,
|
||||
} = props;
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -9,7 +9,7 @@ const Item: FunctionalComponent<ItemProps> = ({ setRef }, { slots }) => {
|
|||
|
||||
return children && children.length
|
||||
? cloneVNode(children[0], {
|
||||
ref: setRef,
|
||||
ref: setRef as any,
|
||||
})
|
||||
: children;
|
||||
};
|
||||
|
@ -19,4 +19,5 @@ Item.props = {
|
|||
default: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
export default Item;
|
||||
|
|
|
@ -45,7 +45,7 @@ function renderChildren<T>(
|
|||
});
|
||||
const key = getKey(item);
|
||||
return (
|
||||
<Item key={key} setRef={ele => setNodeRef(item, ele)}>
|
||||
<Item key={key} setRef={ele => setNodeRef(item, ele as HTMLElement)}>
|
||||
{node}
|
||||
</Item>
|
||||
);
|
||||
|
@ -102,7 +102,7 @@ const List = defineComponent({
|
|||
mergedData: computed(() => props.data || EMPTY_DATA) as any,
|
||||
});
|
||||
|
||||
const componentRef = ref<Element>();
|
||||
const componentRef = ref<HTMLDivElement>();
|
||||
|
||||
// =============================== Item Key ===============================
|
||||
const getKey = (item: Record<string, any>) => {
|
||||
|
@ -257,8 +257,8 @@ const List = defineComponent({
|
|||
const removeEventListener = () => {
|
||||
if (componentRef.value) {
|
||||
componentRef.value.removeEventListener('wheel', onRawWheel);
|
||||
componentRef.value.removeEventListener('DOMMouseScroll' as any, onFireFoxScroll);
|
||||
componentRef.value.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll);
|
||||
componentRef.value.removeEventListener('DOMMouseScroll', onFireFoxScroll as any);
|
||||
componentRef.value.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll as any);
|
||||
}
|
||||
};
|
||||
watchEffect(() => {
|
||||
|
@ -266,8 +266,8 @@ const List = defineComponent({
|
|||
if (componentRef.value) {
|
||||
removeEventListener();
|
||||
componentRef.value.addEventListener('wheel', onRawWheel);
|
||||
componentRef.value.addEventListener('DOMMouseScroll' as any, onFireFoxScroll);
|
||||
componentRef.value.addEventListener('MozMousePixelScroll', onMozMousePixelScroll);
|
||||
componentRef.value.addEventListener('DOMMouseScroll', onFireFoxScroll as any);
|
||||
componentRef.value.addEventListener('MozMousePixelScroll', onMozMousePixelScroll as any);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ const SMOOTH_PTG = 14 / 15;
|
|||
|
||||
export default function useMobileTouchMove(
|
||||
inVirtual: Ref<boolean>,
|
||||
listRef: Ref<Element | undefined>,
|
||||
listRef: Ref<HTMLDivElement | undefined>,
|
||||
callback: (offsetY: number, smoothOffset?: boolean) => boolean,
|
||||
) {
|
||||
let touched = false;
|
||||
|
|
Loading…
Reference in New Issue