-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auto-complete): add dropdown scroll event (#2635)
- Loading branch information
Showing
4 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/web-vue/components/auto-complete/__demo__/scroll.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
```yaml | ||
title: | ||
zh-CN: 下拉菜单滚动 | ||
en-US: Dropdown Scroll | ||
``` | ||
## zh-CN | ||
可以通过 `dropdown-scroll` 监听下拉菜单的滚动事件。或者通过 `dropdown-reach-bottom` 监听下拉菜单滚动到底部的事件。 | ||
|
||
--- | ||
|
||
## en-US | ||
|
||
You can monitor the scroll event of the drop-down menu through `dropdown-scroll`. Or use `dropdown-reach-bottom` to monitor the event of the drop-down menu scrolling to the bottom. | ||
|
||
--- | ||
|
||
```vue | ||
<template> | ||
<a-auto-complete | ||
:data="data" | ||
:style="{ width: '360px' }" | ||
placeholder="please enter something" | ||
@dropdown-scroll="handleScroll" | ||
@dropdown-reach-bottom="handleReachBottom" | ||
/> | ||
</template> | ||
<script> | ||
import { ref } from 'vue' | ||
export default { | ||
setup() { | ||
const data = ref([...Array(100)].map((_, index) => `option-${index}`)) | ||
|
||
const handleScroll = (ev) => { | ||
console.log('scroll', ev) | ||
} | ||
const handleReachBottom = (ev) => { | ||
console.log('reach the bottom', ev) | ||
} | ||
|
||
return { | ||
data, | ||
handleScroll, | ||
handleReachBottom | ||
} | ||
}, | ||
} | ||
</script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters