使用vue.js 绑定数据,加载页面时都会先显示{{ message }},在显示数据.
请问有什么好的办法解决吗?
-------------------------html--------------------------------
<span class="titles" v-if="hasload">{{ news_title1 }}</span>
--------------------------js-----------------------------
new Vue({
el: '#news_banner_a',
data: {
news_title1: dataArr[0],
news_title2: dataArr[1],
news_title3: dataArr[2],
news_title4: dataArr[3],
url1: urlArr[0],
url2: urlArr[1],
url3: urlArr[2],
url4: urlArr[3],
imgPath1: imgPathArr[0],
imgPath2: imgPathArr[1],
imgPath3: imgPathArr[2],
imgPath4: imgPathArr[3]
},
methods: {
hasload: function(dataArr) {
// console.log(dataArr[0]);
if(dataArr[0].length >= 4) {
return true;
} else {
return false;
}
}
}
});
相关分类