# 下拉刷新

用于表达页面刷新时的状态。

# 示例

<template>
  <div class="dof-demo">
    <dof-minibar title="6.2 下拉刷新"></dof-minibar>
    <scroller class="scroller">
      <refresh
        class="refresh"
        @refresh="onrefresh"
        @pullingdown="onpullingdown"
        :display="refreshing ? 'show' : 'hide'"
      >
        <!-- <text class="indicator-text">refresh text...</text> -->
        <midea-lottie-view ref="lottieView" class="indicator" :data="loadJson" :loop="true"></midea-lottie-view>
      </refresh>
      <div class="cell" v-for="num in lists" :key="num">
        <div class="panel"></div>
      </div>
    </scroller>
  </div>
</template>

<style scoped>
.dof-demo {
  background-color: #151617;
}
.scroller {
  padding: 24px;
}
.refresh {
  width: 702px;
  display: -ms-flex;
  display: -webkit-flex;
  display: flex;
  flex-direction: row;
  -ms-flex-align: center;
  -webkit-align-items: center;
  -webkit-box-align: center;
  justify-content: center;
  align-items: center;
}
.indicator-text {
  color: #fff;
  font-size: 42px;
  text-align: center;
}
.indicator {
  margin-bottom: 24px;
  height: 72px;
  width: 88px;
}
.panel {
  height: 344px;
  margin-bottom: 24px;
  flex-direction: column;
  justify-content: center;
  background-color: #1d1f22;
}
</style>
<script>
import { DofMinibar } from 'dolphin-weex-ui'
const modal = weex.requireModule('modal')
// const lottieModule = weex.requireModule('lottieModule')
import lottieData from './loading'

export default {
  components: { DofMinibar },
  data: () => ({
    refreshing: false,
    refreshingFlag: false,
    lists: [1, 2, 3, 4, 5],
    loadJson: JSON.stringify(lottieData)
  }),
  created() {},
  computed: {},
  mounted() {},
  methods: {
    onrefresh() {
      modal.toast({ message: 'Refreshing...' })
      this.refreshing = true
      setTimeout(() => {
        this.refreshing = false
        modal.toast({ message: 'refresh end' })
      }, 2000)
    }
  }
}
</script>


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
85
86
87
88

# loading资源路径

loading.json

点我扫二维码 查看demo
Last Updated: 11/21/2023, 11:35:43 AM