Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(VPullToRefresh): add new component #19666

Merged
merged 17 commits into from Apr 29, 2024
Merged

feat(VPullToRefresh): add new component #19666

merged 17 commits into from Apr 29, 2024

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Apr 22, 2024

closes #4099

  • It allows pulling down as soon as its immediate scrollable parent has scrolled to the top
  • Works for Mobile and Desktop

Description

ScreenRecording2024-04-27at11 05 24am-ezgif com-video-to-gif-converter

Markup:

<template>
  <v-app>
    <v-container class="pa-0">
      <v-row>
        <v-col>
          <div class="scrollable-container bg-grey-lighten-5">
            <v-pull-to-refresh
              :pull-down-threshold="100"
              @load="load"
            >
              <v-list style="background: transparent">
                <v-list-item
                  v-for="item in items"
                  :key="item.value"
                  :title="item.title"
                />
              </v-list>
            </v-pull-to-refresh>
          </div>
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

<script setup>
  import { ref } from 'vue'
  let items = [
    {
      title: '1',
      value: 1,
    },
    {
      title: '2',
      value: 2,
    },
    {
      title: '3',
      value: 3,
    },
    // {
    //   title: '4',
    //   value: 4,
    // },
    // {
    //   title: '5',
    //   value: 5,
    // },
    // {
    //   title: '6',
    //   value: 6,
    // },
  ]

  let count = 2
  async function load ({ done }) {
    // Perform API call
    console.log('loading')
    await new Promise(resolve => setTimeout(() => resolve(), 5500))
    items = Array.from({ length: count * 3 }, (k, v) => ({
      title: `${v + 1}`,
      value: v + 1,
    }))
    console.log('load finish')
    count++
    done('ok')
  }

  // const items = Array.from({ length: 1000 }, (k, v) => v + 1)
</script>
<style>
.scrollable-container {
  max-height: 300px;
  overflow-y: scroll;
}
</style>

@yuwu9145 yuwu9145 marked this pull request as draft April 22, 2024 12:57
@johnleider johnleider added C: New Component This issue would need a new component to be developed. T: feature A new feature labels Apr 23, 2024
@johnleider johnleider added this to the v3.6.0 (Nebula) milestone Apr 23, 2024
@yuwu9145 yuwu9145 marked this pull request as ready for review April 27, 2024 01:10
@yuwu9145 yuwu9145 requested a review from a team April 27, 2024 01:10
@johnleider johnleider merged commit 1816775 into dev Apr 29, 2024
17 of 18 checks passed
@johnleider johnleider deleted the feat-pull-to-refresh branch April 29, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: New Component This issue would need a new component to be developed. T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants