|
|
@@ -8,7 +8,18 @@
|
|
|
<span>视频分区</span>
|
|
|
</div>
|
|
|
<div class="item">
|
|
|
- <v-jstree :data="treeNode" @item-click="itemClick" />
|
|
|
+ <el-tree
|
|
|
+ :data="treeNode"
|
|
|
+ :props="defaultProps"
|
|
|
+ accordion
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ >
|
|
|
+ <span slot-scope="{ node, data }">
|
|
|
+ <span v-if="data.children" :class="data.icon"></span>
|
|
|
+ <span v-else :class="data.icon"></span>
|
|
|
+ <span>{{ node.label }}</span>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
@@ -44,13 +55,11 @@
|
|
|
|
|
|
<script>
|
|
|
import VideoCard from 'components/card/VideoCard'
|
|
|
-import VJstree from 'vue-jstree'
|
|
|
-
|
|
|
import { videoCategory, categoryShortVideos } from '@/api/video'
|
|
|
|
|
|
export default {
|
|
|
name: 'ShortVideo',
|
|
|
- components: { VideoCard, VJstree },
|
|
|
+ components: { VideoCard },
|
|
|
data() {
|
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
@@ -60,7 +69,12 @@ export default {
|
|
|
totalSize: 0,
|
|
|
dataList: [],
|
|
|
categoryId: 1,
|
|
|
- treeNode: []
|
|
|
+ treeNode: [],
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'label',
|
|
|
+ value: 'value'
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -97,6 +111,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.currentPage = 1
|
|
|
+ this.dataList = []
|
|
|
+
|
|
|
+ this.categoryId = data.value
|
|
|
+ this.videoPageWrapper(this.categoryId, this.currentPage)
|
|
|
+ },
|
|
|
handleCurrentChange(currentPage) {
|
|
|
this.currentPage = currentPage
|
|
|
this.videoPageWrapper(this.categoryId, this.currentPage)
|
|
|
@@ -125,15 +146,6 @@ export default {
|
|
|
duration: 3000
|
|
|
})
|
|
|
})
|
|
|
- },
|
|
|
- itemClick(node) {
|
|
|
- const model = node.model
|
|
|
- this.categoryId = model.value
|
|
|
- /* if (model.children.length === 0) {
|
|
|
- this.categoryId = model.value
|
|
|
- }*/
|
|
|
-
|
|
|
- this.videoPageWrapper(this.categoryId, this.currentPage)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -172,10 +184,4 @@ export default {
|
|
|
text-align: center;
|
|
|
padding: 10px;
|
|
|
}
|
|
|
-
|
|
|
-.category-btn {
|
|
|
- padding-left: 14%;
|
|
|
- padding-right: 6%;
|
|
|
- padding-top: 20px;
|
|
|
-}
|
|
|
</style>
|