Mini program uni-app page is highly adaptive
There are many pitfalls in mini programs. It is better to use uni-app to write mini programs.
Add a tag with an ID at the end of the page
and then write this
style in js to assign the value to the parent element. It will be ok.
Attached:
onReady: function () {
const query = uni.createSelectorQuery().in(this);
query.select('#d').boundingClientRect(data => {
this.home_page_height=data.top*2;
}).exec();
}