types(@vant/use): improve Ref param typing

This commit is contained in:
chenjiahan
2020-10-09 20:32:31 +08:00
parent 767ca80499
commit 14d2826cc7
6 changed files with 10 additions and 8 deletions
@@ -37,7 +37,9 @@ export default {
### 类型定义
```ts
function useScrollParent(element: Ref<Element>): Ref<Element>;
function useScrollParent(
element: Ref<Element | undefined>
): Ref<Element | Window | undefined>;
```
### 参数
@@ -39,7 +39,7 @@ function getScrollParent(el: Element, root: ScrollElement = window) {
}
export function useScrollParent(el: Ref<Element | undefined>) {
const scrollParent = ref();
const scrollParent = ref<Element | Window>();
onMounted(() => {
if (el.value) {