avalon數據已更新,視圖未更新的bug修復

  $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進行時時更新......以上是正確的代碼哦  ~~~~javascript

相關文章
相關標籤/搜索