ソースを参照

详情页面高度计算

liuQiang 1 年間 前
コミット
916f7c7077

+ 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);
 				})