我想呈現問題和答案,并將一種樣式附加到問題中,將另一種樣式附加到答案中。我的數據看起來像這樣 dialogTut:{ mainTab:{ q:"data with 42 people?", a:"hehe", q:"Are awesome people?", a:"sometimes", q:"Are awesome people2?", } },我想在 Label 中渲染它,因為它的 nativescript (也許還有其他方法)<StackLayout class="dialog"> <Label v-bind:key="item.index" :text="item" :class="[item==q ? 'h3' : '' , 'a']" v-for="item in mainTab"> </Label> <Button class="drawer-close-button" text="Cancel" @tap="closeDialog"></Button> </StackLayout>我嘗試了一些可能性:class 但不起作用。如何呈現整個列表并將 'h3' 類附加到 item.q 并將 'answer' 類附加到 item.a ?
在 vue for 循環中從對象渲染
Cats萌萌
2021-06-01 18:02:13
