 <template>
 	<view class="tree-content-compontent">
 		<view class="content-box" @click="toggleNodes(item)">
 			<text class="box-text">{{ item.groupName }}</text>
 			<view @click.stop="expandFn">
 				<text class="box-text1">{{ item.totalNum || 0 }}</text>
 				<!-- <u-icon name="arrow-right" color="#B3B3B3" size="40"
					v-if="!expanded && item.children && item.children.length" style="margin-right: 10rpx;"></u-icon>
				<u-icon name="arrow-down" color="#B3B3B3" size="40"
					v-if="expanded && item.children && item.children.length" style="margin-right: 10rpx;"></u-icon> -->
 				<u-icon v-if="!expanded && item.children && item.children.length" name="arrow-right" color="#B3B3B3"
 					size="40"></u-icon>
 				<u-icon v-if="expanded && item.children && item.children.length" name="arrow-down" color="#B3B3B3"
 					size="40"></u-icon>
 			</view>
 			<image v-if="(!item.children || !item.children.length) && !iconShow" style="width:55rpx;height:40rpx;"
 				src="../../static/videoControlIcon/videoIcon1.png" mode="">
 			</image>
 			<!-- <image style="width:80rpx;height:80rpx;float:left" src="../../static/icon-down-black.png" mode="">
			</image> -->
 		</view>
 		<view class="sub-component">
 			<view :class="expanded == true ? 'expandedStyle' : ''"
 				v-if="item.children && item.children.length && expanded">
 				<TreeMenu :iconShow="iconShow" v-for="child in item.children" :key="child.id" :item="child"
 					:treeIndex="treeIndex + 1" @clickItem="clickTreeItem"></TreeMenu>
 			</view>
 		</view>
 	</view>
 </template>

 <script>
 	import TreeMenu from './newIndex.vue';
 	export default {
 		name: 'TreeMenu',
 		components: {
 			TreeMenu
 		},
 		props: ['item', 'treeIndex', 'iconShow'],
 		data() {
 			return {
 				expanded: false,
 			};
 		},
 		methods: {
 			clickTreeItem(item) {
 				console.log(item, 777888)
 				uni.navigateTo({
					url: `./videoList?obj=${JSON.stringify(item)}&sn=${item.projectSn}`
 				})
 			},
 			expandFn(e) {
 				console.log(e, 666)
 				this.expanded = !this.expanded;
 			},
 			toggleNodes(item) {
 				this.$emit('clickItem', item);
 			}
 		},
 	}
 </script>

 <style lang="scss" scoped>
 	.tree-content-compontent {
 		background: white;
 		border-bottom: 2rpx solid #F7F7F7;

 		.content-box {
 			display: flex;
 			align-items: center;
 			justify-content: start;
 			padding: 16rpx 26rpx;
 			position: relative;

 			// border-bottom: 2px solid #D6D6D6;
 			>.box-text {
 				font-family: PingFang SC, PingFang SC;
 				font-weight: 500;
 				font-size: 30rpx;
 				color: #1A1A1A;
 				margin-right: auto;
 				display: inline-block;
 				flex: 1;
 				white-space: nowrap;
 				overflow: hidden;
 				text-overflow: ellipsis;
 			}

 			.box-text1 {
 				font-weight: 500;
 				font-size: 28rpx;
 				color: #B3B3B3;
 				padding: 0 28rpx;
 			}
 		}

 		.sub-component {
 			background: #FFFFFF;

 			.tree-content-compontent {
 				background: #FFFFFF;
 				border: none;
 			}
 		}

 		.expandedStyle {
 			margin-left: 60rpx;
 		}
 	}
 </style>