| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { postMessage } from '@/helpers/native-message'
- import { browser } from '@/helpers/utils'
- import { PullRefresh } from 'vant'
- import { defineComponent, PropType, reactive, Teleport, watch } from 'vue'
- import styles from './index.module.less'
- import { Vue3Lottie } from 'vue3-lottie'
- import AstronautJSON from './datas/data.json'
- import 'vue3-lottie/dist/style.css'
- export default defineComponent({
- name: 'o-full-refresh',
- props: {
- title: String,
- modelValue: {
- type: Boolean,
- default: false
- }
- },
- emits: ['refresh', 'update:modelValue'],
- setup(props, { emit, slots }) {
- const state = reactive({
- fullState: false
- })
- watch(
- () => props.modelValue,
- (val: boolean) => {
- state.fullState = val
- }
- )
- watch(
- () => state.fullState,
- (val: boolean) => {
- emit('update:modelValue', val)
- }
- )
- return () => (
- <PullRefresh
- v-model:modelValue={state.fullState}
- onRefresh={() => emit('refresh')}
- loadingText=" "
- class={styles.pullRefresh}
- >
- {{
- loading: () => (
- <div>
- {<Vue3Lottie class={styles.animateWrap} animationData={AstronautJSON}></Vue3Lottie>}
- </div>
- ),
- pulling: () => (
- <div>
- {<Vue3Lottie class={styles.animateWrap} animationData={AstronautJSON}></Vue3Lottie>}
- </div>
- ),
- loosing: () => (
- <div>
- {<Vue3Lottie class={styles.animateWrap} animationData={AstronautJSON}></Vue3Lottie>}
- </div>
- ),
- default: () => <> {slots.default && slots.default()}</>
- }}
- </PullRefresh>
- )
- }
- })
|