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