不同级别的分类
export default{
data() {
return {
cateList:[],//商品分类的数据列表 默认为空
queryInfo:{//查询条件
type:3,//3级分类
pagenum:1,//当前页码值
pagesize:5//每页显示5条数据
},
total:0,//总数据条数
}
},
created() {//一开始进行获取数据
this.getCateList()//获取商品信息
},
methods: {
async getCateList(){//获取商品分类数据-涉及分页 查询条件
const{data:res}=await this.$http.get('categories',{params:this.queryInfo})
if(res.meta.status!==200) return this.$message.error('获取商品分类数据失败')
//console.log(res.data) 测试
this.cateList=res.data.result//将商品分类数据赋值给cateList
this.total=res.data.total//为总数据条数赋值
}
},
}