반응형
Vuetifyjs 2.0 테마는 관찰자에 따라 변경되지 않음
Vuetifyjs v1.5와 함께 나는 vue watchers를 사용하여 주제를 동적으로 변경할 수 있었다.Vuetifyjs 2.0에서는 더 이상 작동하지 않음
Vue 버전: 2.6.10 Vuetify: 2.0 Vuex: 3.1.1
export default {
data() {
return {
darkEnabled: this.$store.state.darkEnabled
}
},
created () {
this.$vuetify.theme.dark = this.darkEnabled;
},
watch: {
'this.$store.state.darkEnabled'(oldValue, newValue) {
this.$vuetify.theme.dark = newValue;
}
}
}
감시자 콜백의 첫 번째 가치는 newValue이다.당신은 항상 순서를 바꾸고 이전 값을 할당해 왔다.는 것이어야 한다.(newValue, oldValue)
또한, 그것은 그래야 한다.'$store.state.darkEnabled'(newValue)
없이this
.
참조URL: https://stackoverflow.com/questions/57230173/vuetifyjs-2-0-theme-doesnt-change-with-watchers
반응형
'Programing' 카테고리의 다른 글
Java에서 쌍 또는 2-tule 사용 (0) | 2022.04.14 |
---|---|
mapState의 Vue 계산 구문 오류 (0) | 2022.04.14 |
Java가 운영자에게 과부하를 제공하지 않는 이유는? (0) | 2022.04.13 |
오류: mksdcard SDK 도구를 실행할 수 없음 (0) | 2022.04.13 |
Vuex: 소방기지 라우팅.if 문 (0) | 2022.04.13 |