w***@126.com
w***@126.com
  • 发布:2019-12-11 14:16
  • 更新:2019-12-11 14:16
  • 阅读:936

web-view标签不跟“文档流”吗?该如何局部嵌套webview页面?

分类:uni-app

编辑器:HBuilderX 2.4.6.20191210

期待结果:
图表能够紧接在蓝色的内容之后,并且能够跟随页面滚动。

实际结果:
图表浮动在蓝色内容上方,仿佛脱离了文档流,滑动页面,只有蓝色的内容有滚动,图表始终不动。

代码:

<template>  
	<view>  
		<view style="background-color: #0FAEFF; width: 300upx;height: 500upx;">  
			hhhhhh  
		</view>  
		<view style="background-color: #0FAEFF; width: 300upx;height: 500upx;">  
			hhhhhh  
		</view>  
		<web-view src="/hybrid/html/test.html"></web-view>  
	</view>  
</template>  
<script>  
	var wv; //计划创建的webview	  
	export default {  
		components: {},  
		data() {  
			return {}  
		},  
		onReady() {  
			// #ifdef APP-PLUS  
			var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象  
			setTimeout(function() {  
				wv = currentWebview.children()[0]  
				wv.setStyle({  
					top: 100,  
					height: 150  
				})  
			}, 1000); //如果是页面初始化调用时,需要延时一下  
			// #endif  
		},  
	}  
</script>  
<style scoped>  
</style>  

2019-12-11 14:16 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复