当前位置:网站首页>Vant3+ts dropdownmenu drop-down menu, multi data can be scrolled
Vant3+ts dropdownmenu drop-down menu, multi data can be scrolled
2022-06-12 17:48:00 【Enthusiastic learning】

The business need is this effect

The cause of this incident is js Code
let flag = ref(true)
function scrolling(e: any) {
let scrollBottom =
e.target.scrollHeight -
e.target.scrollTop -
e.target.clientHeight;
if (scrollBottom < 40) { // This is to prevent the list from loading all the time
if (flag.value) {
getCenter()
flag.value = false
setTimeout(() => {
flag.value = true
}, 1000);
}
}
}
// When opening the drop-down box
function open() {
nextTick(() => {
let element = document.getElementById('aaa')
if (element) {
element.addEventListener('scroll', scrolling)
}
})
}
// Obtain transfer center
function getCenter() {
menuLoading.value = true
let param = {
code: userInfo.staffNo,
current: menuData.current,
size: menuData.size
}
AjaxGetOrder.selectCenter(param).then(res => {
const { records, total } = res.data
menuData.total = total
status.runStatusList = menuData.current == 1 ? records : status.runStatusList.concat(records || [])
if (records.length == 0) {
return
}
if (menuData.total > status.runStatusList.length) {
menuData.current += 1
} else {
return
}
})
}边栏推荐
- Saturated! Can't future programmers work anymore?
- Continued 2 asp Net core router basic use demonstration 0.2 acquisition of default controller data
- Introduction of one object one code tracing system
- An easy-to-use IDE for small programs
- 一种好用、易上手的小程序IDE
- Tidb Hackathon 2021 - pcloud: conduct icloud pcloud team interview on the database
- First acquaintance with go language
- Vulnhub[DC3]
- Tensorflow reads data from the network
- Arm64棧回溯
猜你喜欢

Volcano engine held a video cloud technology force summit and released a new experience oriented video cloud product matrix

The server time zone value ‘�й���ʱ��‘ is unrecognized or represents more than one time zone. ......

Byte flybook Human Resources Kit three sides

进阶之大山-asp.net core 路由程序基础使用演示0.1

龙芯处理器内核中断讲解

Guitar Pro tutorial how to set up a MIDI keyboard

Learn the mitmproxy packet capturing tool from scratch

极限编程--根源分析实践

JDBC快速入門教程

LCD参数解释及计算
随机推荐
406. reconstruct the queue based on height
Operating with idle funds
小程序+App,低成本获客及活跃的一种技术组合思路
Second week of electric control learning
Cesium parabolic equation
Yyds dry goods inventory leetcode question set 911 - 920
Vulnhub[DC3]
Array sorts in the specified order
全局锁、表锁、行锁
String s = null ; String s = new String(); String s = "; what is the difference between string s?
AlibabaProtect.exe如何删除、卸载
Schedule update | 2022 Microsoft and Intel hacker song competition is in hot registration
MySQL学习笔记
vant3+ts 封装uploader上传图片组件
String s = null ; String s = new String();String s =““ ;String s ;有什么区别?
Soringboot下RestTemplateConfig 配置打印请求响应日志
赛程更新| 2022微软与英特尔黑客松大赛火热报名中
Vulnhub[DC3]
SSM integrates FreeMarker and common syntax
vant3 +ts 封装简易step进步器组件