Commit 7dc95d67 by yanju

服务端渲染一级栏目

parent 4d16de0c
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
}, },
watch:{ watch:{
$route(to,from){ $route(to,from){
this.type = this.$route.query.type this.type = this.$route.query.type
......
...@@ -110,34 +110,38 @@ export default { ...@@ -110,34 +110,38 @@ export default {
this.pages = this.articlePages; this.pages = this.articlePages;
}, },
async dataGetBlogCategory(){ dataGetBlogCategory(){
for(const val of this.typeList){ this.typeList.map((val) => {
if(!val.leaf){ 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.toString(),
})
})
this.list.push({ this.list.push({
label: val.category, label: val.category,
address: '/blog', address: '/blog',
type: val.categoryId.toString(), type: val.categoryId.toString(),
childList childList:[]
}) })
}else{ }else{
await this.list.push({ this.list.push({
label: val.category, label: val.category,
address: '/blog', address: '/blog',
type: val.categoryId.toString(), type: val.categoryId.toString(),
}) })
} }
})
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.toString(),
})
})
this.list[index+1].childList = childList
} }
})
}, },
getLabelTitle(){ getLabelTitle(){
......
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