반응형
Vue 2: "속성을 읽을 수 없습니다"
방금 앱을 Vue 2로 업그레이드했는데 이 오류를 벗어날 수 없습니다.
"Uncatched TypeError: VueComponent에서 null 속성 'length'를 읽을 수 없습니다.show Choices (평가: (app.js:310), :33:32)
조건부로 보호하고 있다고 생각했는데, 이 에러가 3시간째 신경이 쓰이고 있습니다.show Choices:
showChoices() {
if(this.filtered) {
if (this.search.length > 2 && this.filtered.length > 0) {
return true;
}
}
return false;
}
A null
값에는 a가 없습니다.length
소유물.코멘트대로this.search
null 입니다.이거 하려고 한 거 아니야?
showChoices() {
if (this.search && this.filtered) {
if (this.search.length > 2 && this.filtered.length > 0) {
return true;
}
}
return false;
}
다음과 같이 늘 검사도 추가해야 합니다.
showChoices() {
if (this.search && this.search.length > 2 && this.filtered && this.filtered.length > 0) {
return true;
}
return false;
}
언급URL : https://stackoverflow.com/questions/41662546/vue-2-cant-get-past-cannot-read-property
반응형
'itsource' 카테고리의 다른 글
Vue js에서 추적 기준 또는 v-for의 키는 어떤 용도로 사용됩니까? (0) | 2022.08.29 |
---|---|
타입 스크립트에서 VueJ를 사용하는 방법 (0) | 2022.08.29 |
Vuex Store는 이름에 snake_case 또는 camelCase 중 어느 것을 사용해야 합니까? (0) | 2022.08.29 |
C 함수에서 문자열을 반환하는 중 (0) | 2022.08.29 |
(리터럴 방식으로) HashMap을 직접 초기화하려면 어떻게 해야 합니까? (0) | 2022.08.29 |