|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
<div> |
|
|
|
|
<el-container> |
|
|
|
|
<el-aside width="350px"> |
|
|
|
|
<el-tree ref="type" :data="typeList" node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" highlight-current @node-click="typeClick"></el-tree> |
|
|
|
|
<el-tree ref="type" :data="typeList" node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" :highlight-current="true" @current-change="typeClick"></el-tree> |
|
|
|
|
</el-aside> |
|
|
|
|
|
|
|
|
|
<el-main style="padding-top: 0"> |
|
|
|
@ -101,6 +101,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
handleId(res) |
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
|
|
this.typeList = res |
|
|
|
|
// 取首个的id和简介 |
|
|
|
@ -109,22 +110,28 @@ export default { |
|
|
|
|
let item = res[0].children[0] |
|
|
|
|
this.categoryId = item.id |
|
|
|
|
this.dataSource = res[0].children[0].dataSource |
|
|
|
|
this.defaultActive = [item.id] |
|
|
|
|
this.defaultActive = [res[0].children[0].id] |
|
|
|
|
// this.defaultActive = [item.id] |
|
|
|
|
this.introduceText = item.introduce |
|
|
|
|
this.introduce = item.introduce |
|
|
|
|
}else{ |
|
|
|
|
this.categoryId = res[0].id |
|
|
|
|
this.dataSource = res[0].dataSource |
|
|
|
|
this.defaultActive = [res[0].id] |
|
|
|
|
this.defaultActive = [res[0].children[0].id] |
|
|
|
|
// this.defaultActive = [res[0].id] |
|
|
|
|
this.introduceText = res[0].introduce |
|
|
|
|
this.introduce = res[0].introduce |
|
|
|
|
} |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.type.setCurrentKey(this.categoryId) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
this.getKeyword() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 分类点击 |
|
|
|
|
typeClick(data,node){ |
|
|
|
|
console.log(data) |
|
|
|
|
this.editing = false |
|
|
|
|
this.categoryId = data.id |
|
|
|
|
this.defaultActive = [data.id] |
|
|
|
|