瀏覽代碼

详情页面高度计算

liuQiang 1 年之前
父節點
當前提交
916f7c7077
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      pagesA/fire/fpd_detection/detection_details/detection_details.vue

+ 10 - 4
pagesA/fire/fpd_detection/detection_details/detection_details.vue

@@ -74,6 +74,7 @@
 			}
 		},
 		mounted() {
+
 			// uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
 			// 	console.log('data',data);
 			// 	this.wheight = data.height
@@ -120,10 +121,15 @@
 							}
 						});
 					});
-					uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
-						console.log('data',data);
-						this.wheight = data.height
-					}).exec()
+					//dom生成之后再获取节点计算高度
+					this.$nextTick(() => {
+
+						uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(
+							data => {
+								console.log('data', data);
+								this.wheight = data.height
+							}).exec()
+					})
 					console.log('edit页面的val的值', this.formData);
 				})