编辑器: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>