在写分类页面时,获取二级和三级分类
当页面初始化时,默认选中的第一级分类,获取不到它的二级和三级分类。
解决:需要在获取所有分类时候,获取一下默认选中的一级分类,中的二级和三级。
this.secondCate = res.message[0].children
async getCateList() {
const { data: res } = await wepy.get(’/categories’)
this.cateList = res.message
this.secondCate = res.message[0].children
this.$apply()
console.log(this.cateList)
}