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
| <template>
| <view class="container">
| <unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" collection="opendb-feedback" field="content,imgs,contact,mobile">
| <view v-if="error">{{error.message}}</view>
| <view v-else-if="data">
| <uni-list>
| <uni-list-item v-for="(item, index) in data" :key="index" showArrow :clickable="true" @click="handleItemClick(item._id)">
| <template v-slot:body>
| <text>
| <!-- 此处默认显示为_id,请根据需要自行修改为其他字段 -->
| <!-- 如果使用了联表查询,请参考生成的 admin 项目中 list.vue 页面的绑定字段的写法 -->
| {{item._id}}
| </text>
| </template>
| </uni-list-item>
| </uni-list>
| </view>
| <uni-load-more :status="loading?'loading':(hasMore ? 'more' : 'noMore')"></uni-load-more>
| </unicloud-db>
| <uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" />
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| loadMore: {
| contentdown: '',
| contentrefresh: '',
| contentnomore: ''
| }
| }
| },
| onPullDownRefresh() {
| this.$refs.udb.loadData({
| clear: true
| }, () => {
| uni.stopPullDownRefresh()
| })
| },
| onReachBottom() {
| this.$refs.udb.loadMore()
| },
| methods: {
| handleItemClick(id) {
| uni.navigateTo({
| url: './detail?id=' + id
| })
| },
| fabClick() {
| // 打开新增页面
| uni.navigateTo({
| url: './opendb-feedback',
| events: {
| // 监听新增数据成功后, 刷新当前页面数据
| refreshData: () => {
| this.$refs.udb.loadData({
| clear: true
| })
| }
| }
| })
| }
| }
| }
| </script>
|
| <style>
| </style>
|
|