index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <app-view class="order" v-model:animationend="animationend">
  3. <template #header>
  4. <app-navbar title="行情">
  5. <template #footer>
  6. <Search v-model="state.keyword" placeholder="请输入搜索关键词" shape="round" />
  7. </template>
  8. </app-navbar>
  9. </template>
  10. <app-pull-refresh v-model:loading="state.loading" v-model:dataList="state.list" :total="60" @refresh="onRefresh"
  11. v-if="animationend">
  12. <template #default="{ item }">
  13. <Cell :title="item" :to="{ name: 'orderDetail', params: { id: 1 } }" />
  14. </template>
  15. </app-pull-refresh>
  16. </app-view>
  17. </template>
  18. <script lang="ts" setup>
  19. import { ref, reactive } from 'vue'
  20. import { Search, Cell } from 'vant'
  21. import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
  22. const state: {
  23. list: number[];
  24. loading: boolean;
  25. keyword: string;
  26. } = reactive({
  27. list: [],
  28. loading: false,
  29. keyword: ''
  30. });
  31. const animationend = ref(false)
  32. const onRefresh = (callback?: (data: number[]) => void) => {
  33. state.loading = true
  34. setTimeout(() => {
  35. const data = Array.from({ length: 20 }, (v, k) => k + 1)
  36. callback && callback(data)
  37. state.loading = false
  38. }, 1000);
  39. }
  40. </script>
  41. <style lang="less">
  42. @import './index.less';
  43. </style>