Commit 1aaafe72 by yanju

博客获取子分类

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