基于jeecgboot app 修改,因使用了uni simple router 做了完整的路由控制,整个app就一个index.vue是个页面,其他的都成了组件,uniapp中对页面设置的上拉也不能用了,修改如下:
page.json中index加上可刷新

{
"path": "pages/index/index",
"style": {
"enablePullDownRefresh": true
}
},

index.vue

<template>
<view>
<!-- <home :cur="PageCur" v-if="PageCur=='home'" :key="commponent1Key"></home> -->
<myorders v-if="PageCur=='myorders'" :key="commponent1Key"></myorders>
<reservelist v-if="PageCur=='reservelist'" :key="commponent2Key" :refresh="refresh" @refreshOver="overRefresh" :more="more" @moreOver="overMore"></reservelist>
<people v-if="PageCur=='people'" :key="commponent3Key"></people>
<view class="cu-bar tabbar bg-white shadow foot">
<view :class="PageCur=='myorders'?'action text-green':'action text-gray'" @click="NavChange" data-cur="myorders">
<view class='cuIcon-pay'></view>订单
</view>
<view :class="PageCur=='reservelist'?'action text-green':'action text-gray'" @click="NavChange" data-cur="reservelist">
<view class='cuIcon-list'></view>预约记录
</view>
<view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange" data-cur="people">
<view class='cuIcon-people'></view>个人
</view>
</view>
</view>
</template>

<script>
export default {
data() {
return {
PageCur: 'myorders',
commponent1Key: 0,
commponent2Key: 0,
commponent3Key: 0,
refresh:false,
more:false
}
},
onLoad:function(){
let cur = this.$Route.query.cur
if(cur){
this.PageCur = cur
}else{
this.PageCur = 'myorders'
}

++this.commponent1Key
++this.commponent2Key
++this.commponent3Key
},
onPullDownRefresh() {
console.log('begin fresh')
this.refresh = true
},
onReachBottom(){
console.log('begin more')
this.more = true
},
methods: {
NavChange: function(e) {
this.PageCur = e.currentTarget.dataset.cur
},
overRefresh(){
uni.stopPullDownRefresh()
this.refresh = false
console.log('end fresh')
},
overMore(){
this.more = false
console.log('over more')
}

}
}
</script>

<style>

</style>

子控件reservelist 中

<template>
<view>
<cu-custom bgColor="bg-gradual-blue">
<block slot="content">预约记录</block>
</cu-custom>
<scroll-view>
<view v-for="(item) in dataSource" :key="item.id">
<view class="cu-card article" :class="isCard?'no-card':''">
<view class="cu-item shadow">
<view class="title"><view class="text-cut">{{item.title}}</view></view>
<view class="content">
<view class="desc">


</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="cu-tabbar-height margin-top"></view>
</view>
</template>

<script>
import Tips from '@/common/util/tip.js'
import {
http
} from '@/common/service/service.js'
export default {
name: 'reservelist',
props: {
refresh: {
type: Boolean,
default: false
},
more: {
type: Boolean,
default: false
}
},
data() {
return {
dataSource: [],
ipagination: {
current: 1,
pageSize: 3,
total: 0
}
}
},
created() {
this.loadData()
},
watch: {
refresh(val) {
if (val) {
this.ipagination.current=1
this.loadData()
this.$emit('refreshOver')
}
},
more(val) {
if (val) {
if(this.ipagination.total>this.dataSource.length){
this.ipagination.current++
this.loadData()
}
// this.$emit('moreOver')
}
}
},
methods: {
loadData() {
let p={
pageNo:this.ipagination.current,
pageSize:this.ipagination.pageSize
}
http.request({
method: 'GET',
url: '/meet/reserve/reserveRoom/listReserveForH5',
data:p
}).then(res=>{
if(res.data.success){
let ds = res.data.result.records
this.ipagination.total = res.data.result.total
if(this.ipagination.current==1){
this.dataSource = ds
}else{
ds.forEach(row=>{
this.dataSource.push(row)
})
}
}else{
Tips.error(res.data.message)
}
}).finally(()=>{
this.$emit('moreOver')
})
},
totest() {
this.$Router.push({
name: 'home'
})
}
}
}
</script>

<style>

</style>

这样简单的一级页面和二级组件还好些,如果组件中再跳转三级组件,那就麻烦了