因?yàn)閷?duì)小程序父標(biāo)簽和子標(biāo)簽的布局還不是特別了解霜瘪,不像ios喧半,父標(biāo)簽固定信认,子標(biāo)簽通過mansory去布局距離父的底部多少即可材义。小程序的我能想到的就是動(dòng)態(tài)算出每一個(gè)標(biāo)簽的高度,然后總高度減掉就是想得到的子標(biāo)簽的高度了狮杨。如果有哪位大神可以指導(dǎo)一二母截,感激不盡~~~
1、首先給你的view標(biāo)簽對(duì)象一個(gè)id選擇器
<view id='viewID'>
<view id="scriptID">
2橄教、js文件中清寇,創(chuàng)建節(jié)點(diǎn)選擇器
? ? ? ? var query = wx.createSelectorQuery();
? ? ? ? //選擇id
? ? ? ? query.select('#numID').boundingClientRect()
? ? ? ? query.select('#scriptID').boundingClientRect()
? ? ? ? query.exec(function (res) {
? ? ? ? ? //res就是 所有標(biāo)簽為mjltest的元素的信息 的數(shù)組
? ? ? ? ? console.log('所有:',res);
? ? ? ? ? //取高度
? ? ? ? ? that.setData({
? ? ? ? ? ? storyHeight:that.data.detailHeight -(res[0].height+res[1].height)
? ? ? ? ? })
? ? ? ? });