Skip to content

Commit

Permalink
♻️ watch -> computed로 수정
Browse files Browse the repository at this point in the history
 - computed가 코드가 더 보기 좋음
 - 캐싱을한다.
  • Loading branch information
padosum committed Feb 28, 2023
1 parent e7c3fcd commit 12aba54
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/views/LearnView.vue
Expand Up @@ -37,16 +37,14 @@ import 'swiper/css/effect-cards';
import { Swiper, SwiperSlide } from 'swiper/vue';
import { EffectCards, Navigation } from 'swiper';
import { ref, computed, watch } from 'vue';
import type { Ref } from 'vue';
import { ref, computed } from 'vue';
import { useDisplay } from 'vuetify';
import { useStore } from 'vuex';
import type { MyStore } from '@/store/types';
import { useRoute } from 'vue-router';
import LearnsetCard from '@/components/LearnsetCard.vue';
import type { Learnset } from '@/types/interfaces';
const modules = [EffectCards, Navigation];
Expand All @@ -58,15 +56,11 @@ const {
params: { id },
} = route;
const learnset: Ref<Learnset> = ref(
store.getters.learnset(id as string)[0] as Learnset
);
watch(showReviewCards, (show) => {
if (show) {
learnset.value = store.getters.reviewCards({ id: id as string })[0];
const learnset = computed(() => {
if (showReviewCards.value) {
return store.getters.reviewCards({ id: id as string })[0];
} else {
learnset.value = store.getters.learnset(id as string)[0];
return store.getters.learnset(id as string)[0];
}
});
Expand Down

1 comment on commit 12aba54

@vercel
Copy link

@vercel vercel bot commented on 12aba54 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

flashmd – ./

flashmd-padosum.vercel.app
flashmd-git-main-padosum.vercel.app
flashmd.vercel.app
flash.padosum.dev

Please sign in to comment.