要實現的佈局:佈局
可選列表中點擊的選項會顯示在已選列表,已選列表中的選項能夠點擊刪除。
code
實現需求的思路:三欄分開,頂欄和低欄直接fixed。
cdn
實現過程當中出現的問題:blog
頂欄根據選擇添加和刪除動態變換高度,所以可選列表位置也要動態變化。it
實現需求的思路:只fixed底欄,已選和可選在一個view裏共高度。io
實現過程當中出現的問題:console
項目中使用了第二種方法。function
scroll-view
賦值動態的
padding-bottom
來抵消頂欄的動態增長和底欄的遮擋。
const query = wx.createSelectorQuery()
query.select('.box').boundingClientRect()
class
query.exec(function (res) {
select
console.log(res)
let bottomHeight = res[0].height;
that.setData({ bottomHeight })
})
let bottomHeight = that.data.bottomHeight ;
const query = wx.createSelectorQuery()
query.select('.voucher-selected-box').boundingClientRect()
query.exec(function (res) {
console.log(res)
let boxHeight = bottomHeight+res[0].bottom;
that.setData({
boxHeight
})
})
記錄工做平常遇到的問題,今天也是充實的一天!