mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] List: add check method (#1590)
This commit is contained in:
parent
428cb5059a
commit
fe5aae7515
@ -64,3 +64,11 @@ export default {
|
||||
| Event | Description | Arguments |
|
||||
|-----------|-----------|-----------|
|
||||
| load | Triggered when the distance between the scrollbar and the bottom is less than offset | - |
|
||||
|
||||
### Methods
|
||||
|
||||
Use ref to get list instance and call instance methods
|
||||
|
||||
| Name | Attribute | Return value | Description |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| check | - | - | Check scroll position |
|
||||
|
@ -41,7 +41,7 @@ export default create({
|
||||
this.handler(true);
|
||||
|
||||
if (this.immediateCheck) {
|
||||
this.$nextTick(this.onScroll);
|
||||
this.$nextTick(this.check);
|
||||
}
|
||||
},
|
||||
|
||||
@ -59,16 +59,16 @@ export default create({
|
||||
|
||||
watch: {
|
||||
loading() {
|
||||
this.$nextTick(this.onScroll);
|
||||
this.$nextTick(this.check);
|
||||
},
|
||||
|
||||
finished() {
|
||||
this.$nextTick(this.onScroll);
|
||||
this.$nextTick(this.check);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onScroll() {
|
||||
check() {
|
||||
if (this.loading || this.finished) {
|
||||
return;
|
||||
}
|
||||
@ -109,7 +109,7 @@ export default create({
|
||||
/* istanbul ignore else */
|
||||
if (this.binded !== bind) {
|
||||
this.binded = bind;
|
||||
(bind ? on : off)(this.scroller, 'scroll', this.onScroll);
|
||||
(bind ? on : off)(this.scroller, 'scroll', this.check);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,3 +64,11 @@ export default {
|
||||
| 事件名 | 说明 | 参数 |
|
||||
|-----------|-----------|-----------|
|
||||
| load | 滚动条与底部距离小于 offset 时触发 | - |
|
||||
|
||||
### 方法
|
||||
|
||||
通过 ref 可以获取到 list 实例并调用实例方法
|
||||
|
||||
| 方法名 | 参数 | 返回值 | 介绍 |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| check | - | - | 检查当前的滚动位置,若已滚动至底部,则会触发 load 事件 |
|
||||
|
Loading…
x
Reference in New Issue
Block a user