반응형
템플릿에서 작업하지만 계산된 속성에서 작업하지 않는 혼합
vue.js 컴포넌트에서는 다음과 같이 선언된 서플라이 스토어의 mixin을 사용하고 있습니다.
mixins: [
use('Categories'),
],
computed: {
...mapGetters({
getMainCategories: 'categories/getMainCategories',
ss: 'categories/getSubcategories',
}),
(...)
템플릿에서 직접 접속하면 정상적으로 동작합니다.{{getMainCategories}}그러나 다른 계산된 속성에서 액세스하려고 하면 다음과 같이 됩니다.
categoriesSelectValues() {
if (this.getMainCategories.length > 0) {
}
else return []
}
나는 이해한다
[Vue warn]: Error in render: "TypeError: this.getMainCategories is undefined"
뭐가 문제인지 전혀 모르겠어요.특히 다른 컴포넌트도 거의 같은 컴포넌트를 가지고 있기 때문에 정상적으로 동작하고 있습니다.
this.getMainCategories개체를 반환합니다. 개체 길이는 항상 정의되지 않습니다!
언급URL : https://stackoverflow.com/questions/58454845/mixin-working-in-template-but-not-from-computed-property
반응형
'programing' 카테고리의 다른 글
| javax.net.ssl 해결.SSLHandshakeException: sun.security.validator.검증자예외: PKIX 경로 구축에 실패했습니다. 오류? (0) | 2022.07.27 |
|---|---|
| C/C++ 소스로 컴파일되는 프로그래밍 언어? (0) | 2022.07.27 |
| c에서 nan과 inf를 어떻게 사용하는가? (0) | 2022.07.26 |
| VueJs Vue.component에서 데이터를 가져오는 방법 (0) | 2022.07.26 |
| 함수를 사용하여 포인터에 포함된 주소 변경 (0) | 2022.07.26 |