修改高度控制

This commit is contained in:
daihh
2022-06-27 13:35:49 +08:00
parent 8e5c8299bf
commit 86864e4757

View File

@@ -59,7 +59,7 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div class="searBox" v-if="speciData.length > 15"> <div class="searBox" v-if="searchwd">
<el-button type="text" id="closeSearchBtn" @click="closeSearch"> <el-button type="text" id="closeSearchBtn" @click="closeSearch">
{{word}} {{word}}
<i :class="showAll ? 'el-icon-arrow-up ': 'el-icon-arrow-down'"></i> <i :class="showAll ? 'el-icon-arrow-up ': 'el-icon-arrow-down'"></i>
@@ -281,8 +281,9 @@ export default {
speciData:[], speciData:[],
moreState: 1, // 1 加载更多 2 加载中 3无数据 moreState: 1, // 1 加载更多 2 加载中 3无数据
isSeach: false, isSeach: false,
searchwd: true, searchwd: false,
showAll: true, //是否展开全部 showAll: true, //是否展开全部
initHeight:40,//原始 高度
searchRecords: [], searchRecords: [],
caseList: { caseList: {
count: 0, count: 0,
@@ -326,9 +327,9 @@ export default {
this.queryCondition.orgDomain = null; this.queryCondition.orgDomain = null;
}; };
this.specialized(); this.specialized();
this.$nextTick(function() { // this.$nextTick(function() {
this.closeSearch(); // this.closeSearch();
}); // });
if (!this.portalCase.readProtocol) { if (!this.portalCase.readProtocol) {
this.protocolDialogVisible = true; this.protocolDialogVisible = true;
} }
@@ -362,9 +363,14 @@ export default {
}, },
methods: { methods: {
specialized(){ specialized(){
let $this=this;
apiCase.majorTypes().then(res =>{ apiCase.majorTypes().then(res =>{
if(res.status == 200){ if(res.status == 200){
this.speciData = res.result this.speciData = res.result;
this.$nextTick(function() {
$this.initHeight = document.getElementById("searchBox").offsetHeight;
$this.closeSearch();
});
} }
}) })
}, },
@@ -399,17 +405,18 @@ export default {
closeSearch() { closeSearch() {
this.showAll = !this.showAll; this.showAll = !this.showAll;
var searchBoxHeght = document.getElementById("searchBox"); var searchBoxHeght = document.getElementById("searchBox");
var searchBoxWidth = document.getElementById("searchBox"); //console.log(this.initHeight,'this.initHeight');
if (searchBoxWidth.clientWidth > 950) { if(this.initHeight>80){
this.searchwd = false; this.searchwd = true;
} }
if (this.showAll == false) { //console.log(het,'het');
searchBoxHeght.style.height = 40 + "px"; if(this.showAll){
//searchBoxHeght.style.height = "auto";
searchBoxHeght.style.maxHeight = this.initHeight + "px";
}else{ }else{
searchBoxHeght.style.height = "auto"; searchBoxHeght.style.maxHeight = 70 + "px";
} }
}, },
getAnkingData() { getAnkingData() {
apiCase.usernameList(5).then(res => { apiCase.usernameList(5).then(res => {
if (res.status == 200) { if (res.status == 200) {
@@ -781,6 +788,7 @@ export default {
} }
#searchBox { #searchBox {
overflow: hidden; overflow: hidden;
} }
.ranking-title { .ranking-title {
line-height: 34px; line-height: 34px;