<template> <div v-bind:class="divClass"> <v-card> <h3>Test</h3> </v-card> </div></template>我使用計算屬性來應用類: computed: { divClass() { return this.$store.state.lineData.data.length > 0 ? ".customcol .triggered" : ".customcol"; }, }這些類的樣式在這里:<style scoped>.customcol { width: 100% !important; transition: width 0.3s ease;}.customcol .triggered { width: 75% !important;}</style>我可以看到類已在控制臺中應用,但element.style { }只是空的,div 的寬度不是 100%。我究竟做錯了什么?
不應用具有計算屬性的 VueJS 樣式
aluckdog
2022-12-29 13:47:01