Open History to see the last commit
1<script setup lang="ts">
2import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
3import { ref } from 'vue'
4import PostDetail from './PostDetail.vue'
5import PostList from './PostList.vue'
6β
7const postId = ref(-1)
8const setPostId = (id: number) => {
9 postId.value = id
10}
11</script>
12β
13<template>
14 <p>
15 As you visit the posts below, you will notice them in a loading state the
16 first time you load them. However, after you return to this list and click
17 on any posts you have already visited again, you will see them load
18 instantly and background refresh right before your eyes!
19 <strong>
20 (You may need to throttle your network speed to simulate longer loading
21 sequences)
22 </strong>
23 </p>
24 <PostDetail v-if="postId > -1" :post-id="postId" @set-post-id="setPostId" />
25 <PostList v-else @set-post-id="setPostId" />
26 <VueQueryDevtools initial-is-open />
27</template>