forked from airyland/vux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIssue698.vue
84 lines (81 loc) · 2.77 KB
/
Issue698.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
<div class="topic-body">
<scroller lock-x use-pullup use-pulldown height="-1.44" @pullup:loading="loadMore" @pulldown:loading="refresh" :pullup-status.sync="pullupStatus" v-ref:scroller>
<group gutter="0">
<div class="box2">
<p v-for="i in n" :style="'position: absolute; visibility: hidden;height:200px;top:' + i * 200 + 'px'">placeholder {{i}}</p>
<self-goods-list :list="topicGoodsList" :banner="banner" goods-box-class="topic-goods-list" img-class="topic-goods-img" incart ></self-goods-list>
</div>
</group>
<div slot="pullup" class="xs-plugin-pullup-container xs-plugin-pullup-up" style="position: absolute; width: 100%; height: 0.533333rem; bottom: -0.533333rem; text-align: center;">
<span v-show="pullupStatus === 'default'"></span>
<span class="pullup-arrow" v-show="pullupStatus === 'down' || pullupStatus === 'up'" :class="{'rotate': pullupStatus === 'up'}">上拉加载更多</span>
<span v-show="pullupStatus === 'loading'"><spinner type="ios-small"></spinner></span>
</div>
</scroller>
</div>
</template>
<script>
import { SelfGoodsList, Group, Scroller, Spinner } from '../components'
const version = require('../../package.json').version
const interfaces = require('../interfaces.json')
export default {
components: {
SelfGoodsList,
Group,
Scroller,
Spinner
},
route: {
data () {
setTimeout(() => {
// document.querySelector('.box2').innHtml=''
this.$http.get(interfaces.topicGoods, {n: '0'})
.then((response) => {
console.log('data:' + JSON.stringify(response))
this.$set('topicGoodsList', response.body.jcdata[0].goods)
})
}, 2000)
}
},
methods: {
loadMore (uuid) {
var _this = this
_this.$http.get(interfaces.topicGoods, {n: '9'})
.then((response) => {
setTimeout(() => {
console.log('data:' + JSON.stringify(response.body.jcdata[0].goods))
_this.topicGoodsList.push(...response.body.jcdata[0].goods)
_this.n += 10
_this.$nextTick(() => {
_this.$broadcast('pullup:reset', uuid)
})
}, 2000)
})
},
refresh (uuid) {
setTimeout(() => {
// document.querySelector('.box2').innHtml=''
this.$http.get(interfaces.topicGoods, {n: '0'})
.then((response) => {
console.log('data:' + JSON.stringify(response))
this.$set('topicGoodsList', response.body.jcdata[0].goods)
})
this.$nextTick(() => {
this.$broadcast('pulldown:reset', uuid)
})
}, 2000)
}
},
data () {
return {
topicGoodsList: [],
n: 30,
pullupEnabled: true,
pullupStatus: 'default',
banner: '',
version
}
}
}
</script>