반응형
Vuex 작업으로 종속성을 가져오는 방법
함수를 Vuex 작업으로 가져오는 올바른 방법은 무엇입니까?액션 코드에 Firebase를 Import하려고 하면 다음과 같은 eslint 오류가 나타나기 때문에 질문합니다.
'doc' is declared but its value is never read.ts(6133)
'doc' is defined but never used.eslintno-unused-vars
(alias) function doc(firestore: FirebaseFirestore, path: string, ...pathSegments: string[]): DocumentReference<DocumentData> (+2 overloads)
import doc
여기 있습니다.actions.js
코드:
import { doc } from "firebase/firestore"
import {db} from '~/plugins/firebase.js'
export default {
async getUserProfile({ commit }, authUser) {
try {
const docRef = doc(db, 'users', authUser.uid) // <----trying to use `doc()` here but get that eslint error
....
}
....
}
를 Import 할 수 없는 이유는 무엇입니까?doc()
에 기능하다getUserProfile()
액션?
스크린샷으로 업데이트됨:
결국, 이것은 이 사실이 초래한 것이다.doc
코멘트의 OP에 기재된 바와 같이 코드 후반부에서 (재) 선언되었습니다.따라서 ESlint가 사용되지 않은 변수에 대해 불만을 표시한 것입니다.
언급URL : https://stackoverflow.com/questions/68408282/how-to-import-dependency-into-vuex-actions
반응형
'source' 카테고리의 다른 글
html select 태그에서 vue.js 값을 얻는 방법 (0) | 2022.07.26 |
---|---|
콤마 구분 배열 출력 방법 (0) | 2022.07.26 |
ArrayList.clear()와 ArrayList.removeAll()의 차이점은 무엇입니까? (0) | 2022.07.26 |
Vue 3 클래스 기반 API, 함수 기반 API, 리액티브 API 및 컴포지션 API란 무엇입니까? (0) | 2022.07.23 |
Vue.js: API에서 데이터를 가져와 하위 컴포넌트에 전달(간단한 예) (0) | 2022.07.23 |