一,小程序当弹出弹框时,禁止弹框底部滚动,只滚动弹框内容
最外层遮罩层上加上:catchtouchmove="true"
,弹框里面需要滚动部分用 scroll-view
包裹,scroll-y="true"
<view wx:if="{{showTypeModal}}" class="mask" catchtouchmove="true">
<view class="modalContent" style="top: {{height}}px">
<view class="modalBox">
<view class="title">
<view class="type">
<view>{{modalTypeTitle}}</view>
<view>({{noticeTypes.length}})</view>
</view>
<view class="cancel" @tap="cancel">取消</view>
</view>
<SearchBar class="searchBarStl" @search.user="search" searchPlaceholder="请输入关键词搜索" showCancelBtn="hidden" />
<scroll-view class="list" scroll-y="true" wx:if="{{noticeTypes.length > 0}}">
<view class="{{title === '全部类型' ? 'selected' : 'default'}}" @tap="chooseType('全部类型')">全部类型</view>
<repeat for="{{noticeTypes}}" key="index" index="index" item="item">
<view class="{{title === item ? 'selected' : 'default'}}" @tap="chooseType({{item}})">{{item}}</view>
</repeat>
</scroll-view>
<view wx:else class="empty">暂无数据</view>
</view>
</view>
</view>
二,自定义头部导航栏
navigationStyle: 'custom',
注:
wx.getMenuButtonBoundingClientRect();
获取胶囊位置
async onLoad() {
if (!app.globalData.systeminfo) {
app.globalData.systeminfo = wx.getSystemInfoSync();
}
if (!app.globalData.headerBtnPosi) {
app.globalData.headerBtnPosi = wx.getMenuButtonBoundingClientRect();
}
let statusBarHeight = app.globalData.systeminfo.statusBarHeight // 状态栏高度
let headerPosi = app.globalData.headerBtnPosi // 胶囊位置信息
let btnPosi = { // 胶囊实际位置,坐标信息不是左上角原点
height: headerPosi.height,
headerPosi.width,
top: headerPosi.top - statusBarHeight, // 胶囊top - 状态栏高度
bottom: headerPosi.bottom - headerPosi.height - statusBarHeight, // 胶囊bottom - 胶囊height - 状态栏height (胶囊实际bottom 为距离导航栏底部的长度)
right: app.globalData.systeminfo.windowWidth - headerPosi.right // 这里不能获取 屏幕宽度,PC端打开小程序会有BUG,要获取窗口高度 - 胶囊right
}
var cusnavH = btnPosi.height + btnPosi.top + btnPosi.bottom // 导航高度
this.statusBarHeight = statusBarHeight; // 状态栏高度
this.navbarHeight = headerPosi.bottom + btnPosi.bottom; // 顶部导航栏高度
this.cusnavH = cusnavH; // title高度
this.$apply()
const height = headerPosi.bottom + btnPosi.bottom;
this.$emit('commonNavAttr', height)
}
git命令
stash
:存储临时代码。reset --soft
:软回溯,回退 commit 的同时保留修改内容。cherry-pick
:复制 commit。revert
:撤销 commit 的修改内容。reflog
:记录了 commit 的历史操作。