修复搜索栏显示BUG
This commit is contained in:
@@ -20,15 +20,14 @@ export default {
|
|||||||
size: {default: "small"}
|
size: {default: "small"}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isSingleRow() {
|
isSingleRow: v => v.height <= 45
|
||||||
return this.height <= 45
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
height: 0,
|
height: 0,
|
||||||
rightHeight: 0,
|
rightHeight: 0,
|
||||||
searchBarStyle: {}
|
searchBarStyle: {},
|
||||||
|
observer: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -39,13 +38,21 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.searchBarStyle.marginBottom = '0'
|
this.searchBarStyle.marginBottom = '0'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
initSize() {
|
||||||
|
this.height = this.$refs?.AiSearchBarZone?.offsetHeight
|
||||||
|
this.rightHeight = this.$refs?.searchRightZone?.offsetHeight
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.height = this.$refs?.AiSearchBarZone?.offsetHeight
|
this.initSize()
|
||||||
this.rightHeight = this.$refs?.searchRightZone?.offsetHeight
|
this.observer = new ResizeObserver(this.initSize)
|
||||||
|
this.observer.observe(this.$refs?.AiSearchBarZone)
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.observer?.disconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user