Skip to content

Commit

Permalink
fix(swipe): support ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Jan 16, 2022
1 parent 63575bb commit 007c3e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/swipe/Swipe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<script lang="ts">
import { defineComponent, ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { useSwipeItems } from './provide'
import { nextTickFrame } from '../utils/elements'
import { doubleRaf, nextTickFrame } from '../utils/elements'
import { props } from './props'
import { isNumber, toNumber } from '../utils/shared'
import type { Ref, ComputedRef } from 'vue'
Expand Down Expand Up @@ -355,7 +355,9 @@ export default defineComponent({
watch(
() => length.value,
() => {
async () => {
// In nuxt, the size of the swipe cannot got when the route is change, need double raf
await doubleRaf()
initialIndex()
resize()
}
Expand Down

0 comments on commit 007c3e6

Please sign in to comment.