@@ -41,7 +41,20 @@ export default {
|
||||
this.statusBarHeight = 20
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 测量自身高度并 emit 给父组件(小程序端无法跨组件查询 DOM,必须自测量)
|
||||
this.$nextTick(() => this.emitHeight())
|
||||
},
|
||||
methods: {
|
||||
emitHeight() {
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query.select('#searchBar').boundingClientRect()
|
||||
query.exec((res) => {
|
||||
if (res && res[0]) {
|
||||
this.$emit('height-change', res[0].height)
|
||||
}
|
||||
})
|
||||
},
|
||||
onInput(e) {
|
||||
this.$emit('input', e.detail.value)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user