数据分类默认显示最里层的第一级

dev
Jo 3 years ago
parent 09153104f1
commit 9223f5c857
  1. 16
      src/pages/data/list/index.vue
  2. 2
      src/pages/stat/list/index.vue

@ -341,19 +341,31 @@ export default {
}, },
// //
selectType(index, indexPath) { selectType(index, indexPath) {
console.log(index, indexPath)
let introduce = '' let introduce = ''
let dataSource = '' let dataSource = ''
this.keyword = '' this.keyword = ''
let list = this.typeList let list = this.typeList
let select = '' let select = ''
// id
function getDeepest(data) {
if (data[0].children && data[0].children.length) {
getDeepest(data[0].children)
} else {
select = data[0].id
}
}
function handleData(data) { function handleData(data) {
data.map((n, i) => { data.map((n, i) => {
// //
if (n.id == index) { if (n.id == index) {
if (n.introduce) introduce = n.introduce if (n.introduce) introduce = n.introduce
if (n.dataSource) dataSource = n.dataSource if (n.dataSource) dataSource = n.dataSource
if (!select) select = n.children.length ? (n.children[0].children.length ? n.children[0].children[0].id : n.children[0].id) : n.id // idid
if (n.children.length) {
getDeepest(n.children)
} else {
select = index
}
} else { } else {
handleData(n.children) handleData(n.children)
} }

@ -70,7 +70,7 @@
<el-table-column prop="download" label="下载量" align="center"></el-table-column> <el-table-column prop="download" label="下载量" align="center"></el-table-column>
<el-table-column prop="click" label="点击量" align="center"></el-table-column> <el-table-column prop="click" label="点击量" align="center"></el-table-column>
</el-table> </el-table>
<div class="fold" v-if="listData.length > initShowLen"> <div class="fold" v-if="listDataAll.length > initShowLen">
<span :class="{active}" @click="toggleList"> <span :class="{active}" @click="toggleList">
展开更多 展开更多
<i class="el-icon-arrow-down"></i> <i class="el-icon-arrow-down"></i>

Loading…
Cancel
Save