Commit 1aaafe72 by yanju

博客获取子分类

parent 709fd648
......@@ -35,6 +35,7 @@ export default {
},
BlogCategory:{
list:'/api/blog/categories',//获取项目分类列表
childList:'/api/blog/',//获取项目分类列表 + {categoryId}/categories
},
BlogPraise:{
praiseList:'/api/blog/' ,//博客点赞 +{blogId}/praises
......
......@@ -16,7 +16,7 @@
class="label-list"
v-for="(item, key) in childList"
:key="`${item}${key}`"
:to="{path: item.address, query: {type: labelId, childId: item.childId}}">
:to="{path: item.address, query: { type: item.childId}}">
{{item.label}}
</nuxt-link>
</div>
......@@ -113,7 +113,6 @@
.label-list-box{
box-sizing: border-box;
width: 308*$length;
height: 122*$length;
padding: 21*$length 23*$length 16*$length 20*$length;
@extend %flex-row-spb;
align-items: start;
......
......@@ -110,13 +110,32 @@ export default {
this.pages = this.articlePages;
},
dataGetBlogCategory(){
this.typeList.map((val,index)=>{
this.list.push({
label: val.category,
address: '/blog',
type: val.categoryId
})
dataGetBlogCategory(){
this.typeList.map(async (val,index)=> {
if(!val.leaf){
let childListData = await this.$axios.$get(config.api.get.BlogCategory.childList+val.categoryId+'/categories')
let childList =[];
childListData.data.map((val,index)=>{
childList.push({
label: val.category,
address: '/blog',
childId: val.categoryId,
})
})
this.list.push({
label: val.category,
address: '/blog',
type: val.categoryId,
childList
})
}else{
this.list.push({
label: val.category,
address: '/blog',
type: val.categoryId
})
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment