1. 修复自定义导航栏高度不对

2. 修复键盘遮罩无效的问题
parent 6b9cfd96
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
"easycom": { "easycom": {
"^u-(.*)": "@/uview/components/u-$1/u-$1.vue" "^u-(.*)": "@/uview/components/u-$1/u-$1.vue"
}, },
// "condition": { //模式配置,仅开发期间生效 "condition": { //模式配置,仅开发期间生效
// "current": 0, //当前激活的模式(list 的索引项) "current": 0, //当前激活的模式(list 的索引项)
// "list": [{ "list": [{
// "name": "test", //模式名称 "name": "test", //模式名称
// "path": "pages/componentsC/test/index", //启动页面,必选 "path": "pages/componentsA/navbar/index", //启动页面,必选
// "query": "id=1&name=2" //启动参数,在页面的-+onLoad函数里面得到 "query": "id=1&name=2" //启动参数,在页面的-+onLoad函数里面得到
// }] }]
// }, },
"pages": [ "pages": [
// 演示-组件 // 演示-组件
{ {
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
mode: 'number', mode: 'number',
random: false, random: false,
tooltip: true, tooltip: true,
mask: true,
} }
}, },
methods: { methods: {
......
...@@ -27,7 +27,21 @@ ...@@ -27,7 +27,21 @@
</template> </template>
<script> <script>
/**
* alertTips 警告提示
* @description 警告提示,展现需要关注的信息
* @tutorial https://uviewui.com/components/alertTips.html
* @property {String} title 辅助性文字,颜色比title浅一点,字号也小一点,可选
* @property {String} description 显示的标题文字
* @property {String} type 关闭按钮(默认为叉号icon图标)
* @property {String} close-able 用文字替代关闭图标,close-able为true时有效
* @property {Boolean} show-icon 是否显示左边的辅助图标
* @property {Boolean} show 显示或隐藏组件
* @event {Function} click 点击组件时触发
* @event {Function} close 点击关闭按钮时触发
*/
export default { export default {
name: 'u-alert-tips',
props: { props: {
// 显示文字 // 显示文字
title: { title: {
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
// 导航栏高度,单位px,非rpx // 导航栏高度,单位px,非rpx
height: { height: {
type: [String, Number], type: [String, Number],
default: 44 default: ''
}, },
// 返回箭头的颜色 // 返回箭头的颜色
backIconColor: { backIconColor: {
...@@ -150,9 +150,12 @@ export default { ...@@ -150,9 +150,12 @@ export default {
let style = {}; let style = {};
style.color = this.titleColor; style.color = this.titleColor;
style.fontSize = this.titleSize + 'rpx'; style.fontSize = this.titleSize + 'rpx';
// #ifndef MP
style.left = (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + 'px'; style.left = (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + 'px';
style.right = (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + 'px'; style.right = (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + 'px';
// #endif
// #ifdef MP // #ifdef MP
// 此处是为了让标题显示区域即使在小程序有右侧胶囊的情况下也能处于屏幕的中间,是通过绝对定位实现的
let rightButtonWidth = systemInfo.windowWidth - menuButtonInfo.left; let rightButtonWidth = systemInfo.windowWidth - menuButtonInfo.left;
style.left = (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + 'px'; style.left = (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + 'px';
style.right = rightButtonWidth - (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + rightButtonWidth + 'px'; style.right = rightButtonWidth - (systemInfo.windowWidth - uni.upx2px(this.titleWidth)) / 2 + rightButtonWidth + 'px';
...@@ -162,12 +165,15 @@ export default { ...@@ -162,12 +165,15 @@ export default {
}, },
// 转换字符数值为真正的数值 // 转换字符数值为真正的数值
navbarHeight() { navbarHeight() {
// #ifndef MP // #ifdef APP-PLUS || H5
return Number(this.height) + Number(this.statusBarHeight); return this.height ? this.height : 44;
// #endif // #endif
// #ifdef MP // #ifdef MP
// 小程序特别处理,让导航栏高度 = 胶囊高度 + 两倍胶囊顶部与状态栏底部的距离之差(相当于同时获得了导航栏底部与胶囊底部的距离) // 小程序特别处理,让导航栏高度 = 胶囊高度 + 两倍胶囊顶部与状态栏底部的距离之差(相当于同时获得了导航栏底部与胶囊底部的距离)
return menuButtonInfo.height + (menuButtonInfo.top - this.statusBarHeight) * 2;//导航高度 // 此方法有缺陷,暂不用(会导致少了几个px),采用直接固定值的方式
// return menuButtonInfo.height + (menuButtonInfo.top - this.statusBarHeight) * 2;//导航高度
let height = systemInfo.platform == 'ios' ? 44 : 48;
return this.height ? this.height : height;
// #endif // #endif
} }
}, },
......
...@@ -15,6 +15,7 @@ class Request { ...@@ -15,6 +15,7 @@ class Request {
loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
timer: null, // 定时器 timer: null, // 定时器
originalData: false, // 是否在拦截器中返回服务端的原始数据,见文档说明 originalData: false, // 是否在拦截器中返回服务端的原始数据,见文档说明
loadingMask: true, // 展示loading的时候,是否给一个透明的梦层,防止触摸穿透
} }
// 判断是否http|https开头的URL // 判断是否http|https开头的URL
...@@ -109,7 +110,8 @@ class Request { ...@@ -109,7 +110,8 @@ class Request {
if(this.config.showLoading) { if(this.config.showLoading) {
this.config.timer = setTimeout(() => { this.config.timer = setTimeout(() => {
uni.showLoading({ uni.showLoading({
title: this.config.loadingText title: this.config.loadingText,
mask: this.config.loadingMask
}) })
}, this.config.loadingTime); }, this.config.loadingTime);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment