【发布时间】:2019-05-17 19:49:52
【问题描述】:
我想呈现问题和答案,并将一种样式附加到问题中,将另一种样式附加到答案中。
我的数据看起来像这样
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 ?
【问题讨论】:
标签: javascript vue.js nativescript