请问实现了吗?
如何使用scrollview实现表头和第一列固定的效果?因项目需求,客户要求界面的样式,需做出一个表头固定以及第一列固定,内容可上下、左右滚动的列表
2020-11-12请问解决了嘛?
在固定表头的同时如何让整个表格可以同步左右滑动?必须要固定表头,但表格过宽要左右滑动,我现在做的这个表头和表格是分开滑动的,体验极差,怎么让它们同步滑动啊 [图片][图片] [图片] wxml: <view class="tableHeader"> <view class="searchbar"> <navigator url='/pages/search_worker/search_worker' class='search-navigator'></navigator> </view> <text class="title">职员信息表</text> <view class="divLine"></view> <scroll-view scroll-x="true"> <view class="tr thColor"> <view class="th">职工号</view> <view class="th">性别</view> <view class="th">姓名</view> <view class="th">年龄</view> <view class="th">科室号</view> <view class="th">联系电话</view> </view> </scroll-view> </view> <scroll-view scroll-x="true" scroll-y="true" style='height:{{tbodyHeight}}px'> <block wx:for="{{result}}" wx:key="id" > <view class="tr"> <view class="td">{{item.id}}</view> <view class="td">{{item.sex}}</view> <view class="td">{{item.name}}</view> <view class="td">{{item.age}}</view> <view class="td">{{item.officeid}}</view> <view class="td">{{item.phonenumber}}</view> </view> </block> </scroll-view> <loadingmore hasmore="{{bool}}"></loadingmore> js: onShow: function () { var that = this; that.getInfo(1); setTimeout(function (){ wx.getSystemInfo({ success: (res) => { let windowHeight = res.windowHeight; console.log(windowHeight); const query = wx.createSelectorQuery().in(that) query.selectAll('.tableHeader').boundingClientRect((rects) => { let rect = rects[0]; console.log(rect); let height = windowHeight - rect.height; that.setData({ tbodyHeight: height.toFixed(0), }) }).exec(); } }); },500) }
2020-11-12请问解决了吗?
scroll-view 追加数据会自动回到顶部,请问怎样解决?没有把数组值全部替换,是不断将数据追加push进数组。 基础库版本:2.10.3 const updateList = `tabs[${activeTab}].list[${page}]` const updatePage = `tabs[${activeTab}].page` this.setData({ [updateList]: res, [updatePage]: page + 1 }) <!-- 这是自定义组件的内部WXML结构 --> <scroll-view class="tab-content" enable-back-to-top="{{true}}" scroll-y="{{true}}" scroll-anchoring="{{true}}" lower-threshold="100" bindscrolltolower="updateGameList"> <view class="game-card-wrap" wx:for="{{gameListWrap}}" wx:for-item="gameList" wx:for-index="gameListIdx" wx:key="gameListIdx"> <view class="game-card" hover-class="hover-class" hover-start-time="100" wx:for="{{gameList}}" wx:for-item="game" wx:for-index="gameIdx" wx:key="gid"> </view> </view> </scroll-view>
2020-11-09我也遇到了,同样的问题,请问解决了吗
data定义数组声明,方法内调用之后提示not a function?有时可以正常运行有时候直接报错[代码]data:{[代码][代码] [代码][代码]datalist: [],[代码][代码]}[代码][代码]ensure() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]var[代码] [代码]datalist=that.data.datalist;[代码][代码] [代码][代码]var[代码] [代码]roomName = that.data.roomName;[代码][代码] [代码][代码]console.log(roomName);[代码][代码] [代码][代码]if[代码] [代码](roomName == [代码][代码]''[代码] [代码]|| roomName == [代码][代码]null[代码][代码]) {[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'请输入房间名称'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'none'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]return[代码] [代码]false[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]datalist.push(roomName);[代码][代码] [代码][代码]wx.setStorageSync([代码][代码]'datalist'[代码][代码], datalist)[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]datalist: datalist,[代码][代码] [代码][代码]addState: ![代码][代码]this[代码][代码].data.addState[代码][代码] [代码][代码]})[代码][代码]},[代码][图片]
2020-01-17