$ npm ci or $ npm install
$ npm run serve
Vuex
보다 편리하고 직관적으로 사용 가능Mutations
이 없어 코드가 간결해진다.Typescript
를 잘 지원하고 Autocompletion
도 빠르고 정확--src
----assets : 에셋 모음(이미지, 스타일 등)
----components : 컴포넌트 파일
----router : 라우터 관리(프로젝트 페이지 구성)
----services : API 통신, LocalStorage 관련
----store : 상태 관리(pinia 관련)
----utils : 유틸 함수 관리
----views : 페이지 관리(라우터 관련)
-- components
---- BasicButton.vue - 글로벌 버튼 컴포넌트
---- BasicInput.vue - 글로벌 인풋 컴포넌트
---- Counter.vue - 인증 코드 타이머 컴포넌트
---- UserCard.vue - 회원 정보 카드 컴포넌트
common, auth, user
로 하위 폴더로 만들면서 확장-- store ---- auth.ts - state, actions, getters로 구성되어 있다. (getters는 사용하지 않고 있다.)
pinia
는 중첩 구조가 없고 평면 구조이다.store
폴더 아래 auth.ts
와 동일하게 작성해주면 된다.- No more nested structuring of modules. You can still nest stores implicitly by importing and using a store inside another but Pinia offers a flat structuring by design while still enabling ways of cross composition among stores. You can even have circular dependencies of stores.
- No namespaced modules. Given the flat architecture of stores, "namespacing" stores is inherent to how they are defined and you could say all stores are namespaced.
-
새로운 기술과 문법을 사용하게 된 이유를 설명드리겠습니다.
실무에서 Vue2, Javacsript 구조로 작업을 했습니다. Typescript를 적용해보려고 했지만, 여러가지 문제로 하지 못했습니다. 따라서 Typescript를 학습하기 위해 React, Typescript를 사용해 개인공부와 토이프로젝트를 진행하고 있었습니다.
이번에 Typescript를 사용해야 하는데 React를 사용해 작업하려고 했으나, 실무에서 더 많이 쓰고 트러블 슈팅에 편한 Vue를 사용하기로 했습니다. 이제 표준이된 Vue3는 Typescript 지원이 좋아졌고 Setup, Compoisition API를 활용해 더 효율적인 코드를 작성하고자 했습니다. 더 좋은 코드, 더 효율적인 코드를 작성하기 위해 구글링을 통해 새로운 기술들을 보고 적용했습니다.