반응형
구성 요소 내부의 계산된 속성에 프로펠러 값 전달
컴포넌트 내부의 계산된 속성 함수 내에서 프로펠러 값을 사용할 수 있습니까?그렇다면 이 소품으로 어떻게 반품할 수 있을까요?
회전목마.표시하다
props: [
'source',
],
computed: {
items () {
return this.$store.state.(prop value source here).list
}
}
store/categorya.category(categoryb 및 categoryc와 동일)
import categorya from '(...)'
export const state = () => ({
list: categorya
})
갱신하다
Index.vue
carousel(source="categorya")
carousel(source="categoryb")
carousel(source="categoryc")
질문이 좀 애매해요.source가 Vuex 모듈 이름을 지정하는 경우 괄호 표기법을 사용할 수 있습니다.
computed: {
items () {
return this.$store.state[this.source].list
}
}
편집 후
아직 불분명하지만 모듈이 없는지,list
root 스테이트의 속성입니다.그러면 다음 명령을 사용할 수 있습니다.
computed: {
items () {
return this.$store.state.list
}
}
이 사실은list
는 처음에 Import에 의해 정의됩니다.categorya
차이가 전혀 없다.아직 유일한 주(州)이며 이름은list
.
언급URL : https://stackoverflow.com/questions/60454105/pass-prop-value-to-computed-properties-inside-a-component
반응형
'programing' 카테고리의 다른 글
vuejs slick이 v-for와 함께 작동하지 않습니다. (0) | 2022.06.28 |
---|---|
WebStorm Vue 확인되지 않은 변수 또는 유형 (0) | 2022.06.28 |
사용자가 관리 vue 라우터 및 vuex인지 확인합니다. (0) | 2022.06.28 |
gcc 옵션 -fomit-frame-pointer를 이해하려고 합니다. (0) | 2022.06.27 |
memset에 bzero를 사용하는 이유는 무엇입니까? (0) | 2022.06.27 |