Commit 4e513036 by yanju

展开子分类滚动

parent 09453039
......@@ -49,11 +49,12 @@
<yun-icon name="down_arrow" size="10px" color="#999"></yun-icon>
</div>
</div>
<div class="class-list-box" v-if="isShow && isShow2" @mouseleave="isShow=false">
<div class="class-list-box" ref="tagsBox" v-show="isShow && isShow2" @mouseleave="isShow=false">
<select-content
v-for="(item, index) in classList"
:item="item"
:key="`${item}${index}`"
@scrollTop="handleScroll"
@select="handleChange2"
></select-content>
</div>
......@@ -174,6 +175,12 @@ export default {
this.isShow2 = false;
this.$emit('handleClass', this.value);
},
handleScroll(num){
setTimeout(()=>{
this.$refs.tagsBox.scrollTop = this.$refs.tagsBox.scrollTop+40*(num>4?5:num)
})
},
createTag() {
this.$popupbox({
title: '创建标签',
......@@ -317,7 +324,7 @@ export default {
.class-list-box{
position: absolute;
width: 196*$length;
height: 250*$length;
max-height: 250*$length;
overflow-y: auto;
overflow-x: hidden;
z-index: 999;
......
<template>
<div>
<div class="tag-box">
<p v-if="!isHot" @click="handleClick">{{item.tag}}</p>
<div v-if="isHot" @click="handleClick">{{item.tag}}{{item.referenceCount}}</div>
<yun-icon v-if="item.childList" @click="handleClick" :style="{paddingRight:'5px',transform:showChildList?'rotate(180deg)':'rotate(0)'}" name="down_arrow" size="8px" :color="showChildList?'#00AAE6':'#999'"></yun-icon>
<div class="tag-box" @click="handleClick">
<p v-if="!isHot" >{{item.tag}}</p>
<div v-if="isHot">{{item.tag}}{{item.referenceCount}}</div>
<yun-icon v-if="item.childList" :style="{paddingRight:'5px',transform:showChildList?'rotate(180deg)':'rotate(0)'}" name="down_arrow" size="8px" :color="showChildList?'#00AAE6':'#999'"></yun-icon>
</div>
<div v-if="item.childList&&showChildList" >
<p class="tag-child" @click="handleChildClick(val.tag,val,tagId)" v-for="(val,index) in item.childList">{{val.tag}}</p>
<p class="tag-child" @click="handleChildClick(val.tag,val.tagId)" v-for="(val,index) in item.childList">{{val.tag}}</p>
</div>
</div>
......@@ -24,6 +23,9 @@ export default {
default: false
}
},
watch:{
},
data(){
return{
showChildList:false
......@@ -33,14 +35,14 @@ export default {
handleClick(){
if(this.item.childList){
this.showChildList = !this.showChildList;
this.$emit('scrollTop',this.item.childList.length)
}else {
this.$emit('select', this.item.tag, this.item.tagId);
}
},
handleChildClick(tag,id){
this.$emit('select', tag, id);
this.$emit('select',this.item.tag+'>'+ tag, id);
}
}
......@@ -51,6 +53,8 @@ export default {
.tag-box{
@extend %flex-row-spb;
border-bottom: 1px solid #F4F8FA;
box-sizing: border-box;
padding-right: 10px;
> div {
display: inline-block;
......@@ -80,7 +84,6 @@ export default {
.tag-child {
@include fontStyle(12, 40, 500, #999, center);
padding-left: 20*$length;
@extend %cursorPointer;
box-sizing: border-box;
&:hover {
......
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