1.v-for:可循環當前元素--〉使用為:v-for="item in 8"
2.v-if:判斷方法:比較或判斷--〉使用為v-if="badgeAll.status0>0或v-if="tabIndex==0"
3.請求數據調用接口:async success()//方法名稱可自定義{
let res = await this.$http.post('/api/MyOrder/getTotals',{
session: true,//授權調用的參數
});//ES6語法
this.badgeAll = res.data.result;//vue語法,與微信小程序不同
console.log(res);打印函數
}
}
注意:vue里字段需要在data方法里面把badgeAll:{}初始值
請求方法寫好后需要執行方法
created(){
this.success();//執行當前方法
},