Commit 26e6b749 by 李伟康

增加下拉刷新

1 parent 73e734a2
<template> <template>
<div :class="['scroll-view', ScrollViewclass]"> <van-pull-refresh
v-model="refreshing"
@refresh="onRefresh"
:disabled="disabledRefresh"
:class="['scroll-view', ScrollViewclass]"
>
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
...@@ -10,7 +15,7 @@ ...@@ -10,7 +15,7 @@
> >
<slot></slot> <slot></slot>
</van-list> </van-list>
</div> </van-pull-refresh>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
...@@ -20,15 +25,25 @@ export default { ...@@ -20,15 +25,25 @@ export default {
return { return {
loading: false, loading: false,
finished: false, finished: false,
refreshing: false
} }
}, },
props: ['ScrollViewclass'], props: {
ScrollViewclass: String,
disabledRefresh: {
type: Boolean,
default: true
},
},
mounted () { mounted () {
}, },
methods: { methods: {
onLoad () { onLoad () {
this.$emit('ReachBottom') this.$emit('ReachBottom')
}, },
onRefresh () {
this.$emit('onRefresh')
}
} }
} }
</script> </script>
...@@ -37,5 +52,8 @@ export default { ...@@ -37,5 +52,8 @@ export default {
.scroll-view { .scroll-view {
overflow-y: scroll; overflow-y: scroll;
box-sizing: border-box; box-sizing: border-box;
.test {
height: 100%;
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
class="list-box" class="list-box"
@ReachBottom="onReachBottom" @ReachBottom="onReachBottom"
ref="scrollView" ref="scrollView"
:disabledRefresh="false"
@onRefresh="clearData"
> >
<div class="box"> <div class="box">
<template v-for="(i,index) in list"> <template v-for="(i,index) in list">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!