$computed: { pinlei() { var key = this.currentProduct.key || 'youpin'; console.log(key, "我是key") var lang = this.lang; return this.dataProduct[key].category.name[lang] }, jiayou() { var key = this.currentProduct.key || 'youpin'; console.log(key, "我是key") var lang = this.lang; return this.dataProduct[key].hot.name[lang] } },
<li onclick="javascript:;" ms-click="@openSubItem('hot')" ms-visible="@currentSetting.hot.show" ms-class-1="[@currentSubItem == 'hot' && 'active']"> <span style="overflow:hidden;vertical-align: bottom;">{{@jiayou}}</span> </li> <li onclick="javascript:;" ms-click="@openSubItem('category')" ms-visible="@currentSetting.category.show" ms-class-1="[@currentSubItem == 'category' && 'active']"> <span style="overflow:hidden;vertical-align: bottom;" id='testclick'>{{@pinlei}} </span> </li>
总结:由于代码嵌套太多,所以在切换tab的时候,视图就显示了,所以用avalon的computed进行时时更新......以上是正确的代码哦 ~~~~