목록Vue (4)
HIT해
1. store.js 설정 import axios from 'axios' import { defineStore } from 'pinia' import { ref, computed } from 'vue' import router from '@/router' import http from '@/util/http-common.js' const REST_BOARD_API = '기본경로'; // 필수아님 export const useUserStore = defineStore('user', () => { return {} }) store에 주고받을 함수를 작성할 것이다. 내부 함수 선언 형식 1. 데이터를 담아서 보내야할 떄 const updateUser = function(detail){ axios({ url: ..
준비사항 1. 뷰 프로젝트 생성 시 Store 사용 Yes 선언 stores 폴더 내의 product.js 설정 import { ref, computed } from 'vue' import { defineStore } from 'pinia' export const useProductStore = defineStore('product', () => { const productList = ref([ {name: '상품 1', imagePath: 'src/assets/product1.png', price: 10000, isFavorite: false}, {name: '상품 2', imagePath: 'src/assets/product2.png', price: 20000, isFavorite: false}, {..
사전 준비 index.js import { createRouter, createWebHistory } from 'vue-router' import HomeView from '@/views/HomeView.vue' import QuizView from '@/views/QuizView.vue' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ { path: '/', name: 'home', component: HomeView }, { path: '/quiz', name: 'quiz', component: QuizView } ] }) export default router index.js에 컴포..
filter 를 사용해서 해결하는 방법 const busineseCards = ref([{ name: '일론 머스크', title: '테슬라 테크노킹' ,indexx : 1 }, { name: '래리 엘리슨', title: '오라클 창업주' ,indexx : 2}, { name: '빌 게이츠', title: '마이크로소프트 공동창업주' ,indexx : 3}, { name: '래리 페이지', title: '구글 공동창업주' ,indexx : 4}, { name: '세르게이 브린', title: '구글 공동창업주' ,indexx : 5}]) const deleteCardEventt = function (indexx) { const tmp = busineseCards.value.filter((io)=> io..