初次渲染显示效果正常,切换动态内容后失效。
<view class="mcq" style="font-variant: diagonal-fractions;">
{{text}}
</view>
<button bind:tap="onChangeNumber">动态切换</button>
//index.js
Page({
data: {
text: "",
quizs: [
{question: '1/9' },
{question: '3/9'},
{question: '4/9'},
{question: '5/9'},
]
},
onLoad() {
var that = this;
this.setData({
text: that.data.quizs[0].question
})
},
onChangeNumber() {
var that = this;
this.setData({
text: that.data.quizs[2].question
})
}
})
代码片段链接:https://developers.weixin.qq.com/s/tq76gXmN7MJ6