Commit 95fd1c8e authored by wlxuqu's avatar wlxuqu

1. 给Modal弹窗添加异步关闭控制参数async-close和点击遮罩关闭参数mask-close-able

2. 修复$u.route方法type=back时,delta参数无法设置的问题
3. 修复Button按钮水波纹在支付宝小程序无效的问题
4. 给Navbar添加右侧的slot,名为right
5. 添加基础类u-relative(u-rela)和u-absolute(u-abso)
6. 给Switch组件添加active-value和inactive-value
parent a908cb80
......@@ -2,14 +2,14 @@
"easycom": {
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
// "condition": { //模式配置,仅开发期间生效
// "current": 0, //当前激活的模式(list 的索引项)
// "list": [{
// "name": "test", //模式名称
// "path": "pages/componentsB/upload/index", //启动页面,必选
// "query": "id=1&name=2" //启动参数,在页面的-+onLoad函数里面得到
// }]
// },
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [{
"name": "test", //模式名称
"path": "pages/componentsA/navbar/index", //启动页面,必选
"query": "id=1&name=2" //启动参数,在页面的-+onLoad函数里面得到
}]
},
"pages": [
// 演示-组件
{
......
......@@ -22,6 +22,16 @@
<u-icon name="arrow-down-fill" color="#ffffff" size="22"></u-icon>
</view>
</view>
<view class="navbar-right" slot="right" v-if="slotRight">
<view class="message-box right-item">
<u-icon name="chat" size="38"></u-icon>
<u-badge count="18" size="mini" :offset="[-15, -15]"></u-badge>
</view>
<view class="dot-box right-item">
<u-icon name="calendar-fill" size="38"></u-icon>
<u-badge size="mini" :is-dot="true" :offset="[-6, -6]"></u-badge>
</view>
</view>
</u-navbar>
<view class="u-demo">
<view class="u-demo-wrap">
......@@ -48,7 +58,11 @@
<u-subsection current="1" vibrateShort :list="['是', '否']" @change="leftChange"></u-subsection>
</view>
<view class="u-config-item">
<view class="u-item-title">传入slot</view>
<view class="u-item-title">自定义右侧内容</view>
<u-subsection :current="slotRightCurrent" vibrateShort :list="['是', '否']" @change="rightChange"></u-subsection>
</view>
<view class="u-config-item">
<view class="u-item-title">传入整体slot</view>
<u-subsection vibrateShort :list="['无', '搜索框', '搜索+按钮', '搜索+图标']" @change="searchChange"></u-subsection>
</view>
<view class="u-config-item">
......@@ -82,7 +96,18 @@
search: false,
custom: false,
isFixed: true,
keyword: ''
keyword: '',
// #ifdef MP
slotRight: false,
// #endif
// #ifndef MP
slotRight: true
// #endif
}
},
computed: {
slotRightCurrent() {
return this.slotRight ? 0 : 1;
}
},
methods: {
......@@ -107,21 +132,25 @@
if(index == 0) {
this.title = '新闻';
this.useSlot = false;
this.rightSlot = false;
} else if(index == 1) {
this.showAction = false;
this.useSlot = true;
this.rightSlot = false;
this.search = true;
this.slotRight = false;
} else if(index == 2) {
this.useSlot = true;
this.showAction = true;
this.rightSlot = false;
this.search = true;
this.slotRight = false;
} else {
this.useSlot = true;
this.search = true;
this.showAction = false;
this.rightSlot = true;
this.slotRight = false;
}
},
backChange(index) {
......@@ -141,6 +170,14 @@
}
},
rightChange(index) {
if(index == 0) {
this.slotRight = true;
this.useSlot = false;
} else {
this.slotRight = false;
}
},
customChange(index) {
this.search = false;
this.rightSlot = false;
......
......@@ -7,6 +7,8 @@
:size="size" @change="change"
:active-color="activeColor"
:disabled="disabled"
:activeValue="100"
:inactiveValue="1"
></u-switch>
</view>
</view>
......@@ -100,7 +102,7 @@
})
},
change(value) {
// console.log(value);
// console.log(value, this.checked);
}
}
}
......
<template>
<view>
<view class="">
<u-modal v-model="show" @confirm="confirm" :async-close="true"></u-modal>
<u-button @click="showModal">弹起Modal</u-button>
</view>
</template>
<script>
export default {
export default {
data() {
return {
dataList:[{
id:1,
num:0
show: false
}
},
{
id:2,
num:0
}],
};
onLoad: function(opt) {
},
methods: {
valChanges(e,index){
this.dataList[index]['num'] = parseInt(e['value']);
console.log(e);
methods:{
showModal() {
this.show = true;
},
confirm() {
setTimeout(() => {
this.show = false;
}, 3000)
}
};
</script>
<style lang="scss" scoped>
.item {
display: flex;
padding: 20rpx;
}
image {
width: 120rpx;
flex: 0 0 120rpx;
height: 120rpx;
margin-right: 20rpx;
border-radius: 12rpx;
}
}
</script>
.title {
text-align: left;
font-size: 28rpx;
color: $u-content-color;
margin-top: 20rpx;
}
</style>
\ No newline at end of file
......@@ -71,7 +71,7 @@ Vue.use(uView);
```html
<template>
<u-buton>按钮</u-buton>
<u-button>按钮</u-button>
</template>
```
......
......@@ -31,8 +31,8 @@
* alertTips 警告提示
* @description 警告提示,展现需要关注的信息
* @tutorial https://uviewui.com/components/alertTips.html
* @property {String} title 辅助性文字,颜色比title浅一点,字号也小一点,可选
* @property {String} description 显示的标题文字
* @property {String} title 显示的标题文字
* @property {String} description 辅助性文字,颜色比title浅一点,字号也小一点,可选
* @property {String} type 关闭按钮(默认为叉号icon图标)
* @property {String} close-able 用文字替代关闭图标,close-able为true时有效
* @property {Boolean} show-icon 是否显示左边的辅助图标
......
......@@ -297,6 +297,9 @@
// 获取元素节点信息,请查看uniapp相关文档
// https://uniapp.dcloud.io/api/ui/nodes-info?id=nodesrefboundingclientrect
queryInfo = uni.createSelectorQuery().in(this);
//#ifdef MP-ALIPAY
queryInfo = uni.createSelectorQuery();
//#endif
queryInfo.select('.u-btn').boundingClientRect();
queryInfo.exec((data) => {
resolve(data)
......
......@@ -203,6 +203,7 @@
text-align: left;
z-index: 9;
opacity: 1;
background: none;
}
.u-char-item {
......
<template>
<view>
<u-popup :zoom="zoom" mode="center" :z-index="uZIndex" v-model="value" :length="width" :mask-close-able="false" :border-radius="borderRadius">
<u-popup :zoom="zoom"
mode="center" :popup="false"
:z-index="uZIndex" v-model="value"
:length="width" :mask-close-able="maskCloseAble"
:border-radius="borderRadius"
@close="popupClose"
>
<view class="u-model">
<view v-if="showTitle" class="u-model-title u-line-1" :style="[titleStyle]">{{ title }}</view>
<view class="u-model-content">
......@@ -23,12 +29,15 @@
<view
v-if="showConfirmButton"
:hover-stay-time="100"
hover-class="btn-hover"
:hover-class="asyncClose ? 'none' : 'btn-hover'"
class="u-model-footer-button hairline-left"
:style="[confirmBtnStyle]"
@tap="confirm"
>
<u-loading mode="circle" :color="confirmColor" v-if="loading"></u-loading>
<block v-else>
{{confirmText}}
</block>
</view>
</view>
</view>
......@@ -47,8 +56,10 @@
* @property {String | Number} width 模态框宽度(默认600)
* @property {String} content 模态框内容(默认"内容")
* @property {Boolean} show-title 是否显示标题(默认true)
* @property {Boolean} async-close 是否异步关闭,只对确定按钮有效(默认false)
* @property {Boolean} show-confirm-button 是否显示确认按钮(默认true)
* @property {Boolean} show-cancel-button 是否显示取消按钮(默认false)
* @property {Boolean} mask-close-able 是否允许点击遮罩关闭modal(默认false)
* @property {String} confirm-text 确认按钮的文字内容(默认"确认")
* @property {String} cancel-text 取消按钮的文字内容(默认"取消")
* @property {String} cancel-color 取消按钮的颜色(默认"#606266")
......@@ -169,8 +180,22 @@ export default {
contentSlot: {
type: Boolean,
default: false
},
// 是否异步关闭,只对确定按钮有效
asyncClose: {
type: Boolean,
default: false
},
// 是否允许点击遮罩关闭modal
maskCloseAble: {
type: Boolean,
default: false
}
},
data() {
return {
loading: false, // 确认按钮是否正在加载中
}
},
computed: {
cancelBtnStyle() {
......@@ -183,14 +208,35 @@ export default {
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
}
},
watch: {
// 如果是异步关闭时,外部修改v-model的值为false时,重置内部的loading状态
// 避免下次打开的时候,状态混乱
value(n) {
if(n === true) this.loading = false;
}
},
methods: {
confirm() {
this.$emit('confirm');
// 异步关闭
if(this.asyncClose) {
this.loading = true;
} else {
this.$emit('input', false);
}
},
cancel() {
this.$emit('cancel');
this.$emit('input', false);
// 目前popup弹窗关闭有一个延时操作,此处做一个延时
// 避免确认按钮文字变成了"确定"字样,modal还没消失,造成视觉不好的效果
setTimeout(() => {
this.loading = false;
}, 300);
},
// 点击遮罩关闭modal,设置v-model的值为false,否则无法第二次弹起modal
popupClose() {
this.$emit('input', false);
}
}
};
......
......@@ -17,6 +17,9 @@
<view class="u-slot-content">
<slot></slot>
</view>
<view class="u-slot-right">
<slot name="right"></slot>
</view>
</view>
</view>
<!-- 解决fixed定位后导航栏塌陷的问题 -->
......
......@@ -216,7 +216,7 @@
computed: {
propsChange() {
// 引用这几个变量,是为了监听其变化
return `${this.mode}-${this.defaultTime}-${this.startYear}-${this.endYear}-${this.defaultRegion}-${this.defaultCode}`;
return `${this.mode}-${this.defaultTime}-${this.startYear}-${this.endYear}-${this.defaultRegion}-${this.areaCode}`;
},
regionChange() {
// 引用这几个变量,是为了监听其变化
......
......@@ -17,6 +17,8 @@
* @property {String Number} size 开关尺寸,单位rpx(默认50)
* @property {String} active-color 打开时的背景色(默认#2979ff)
* @property {Boolean} inactive-color 关闭时的背景色(默认#ffffff)
* @property {Boolean | Number | String} active-value 打开选择器时通过change事件发出的值(默认true)
* @property {Boolean | Number | String} inactive-value 关闭选择器时通过change事件发出的值(默认false)
* @event {Function} change 在switch打开或关闭时触发
* @example <u-switch v-model="checked" active-color="red" inactive-color="#eee"></u-switch>
*/
......@@ -57,7 +59,17 @@
vibrateShort: {
type: Boolean,
default: false
}
},
// 打开选择器时的值
activeValue: {
type: [Number, String, Boolean],
default: true
},
// 关闭选择器时的值
inactiveValue: {
type: [Number, String, Boolean],
default: false
},
},
data() {
return {
......@@ -83,7 +95,7 @@
this.$emit('input', !this.value);
// 放到下一个生命周期,因为双向绑定的value修改父组件状态需要时间,且是异步的
this.$nextTick(function() {
this.$emit('change', this.value);
this.$emit('change', this.value ? this.activeValue : this.inactiveValue);
})
}
}
......
// 此版本发布于2020-05-08
let version = '1.2.3';
// 此版本发布于2020-05-12
let version = '1.2.5';
export default {
v: version,
......
.u-relative {
.u-relative,
.u-rela {
position: relative;
}
.u-absolute {
.u-absolute,
.u-abso {
position: absolute;
}
......
......@@ -77,7 +77,7 @@ function route(options = {}, params = false) {
}
if (config.type == 'navigateBack' || config.type == 'back') {
return uni.navigateBack({
delta: parseInt(this.delta)
delta: parseInt(config.delta ? config.delta : this.delta)
});
}
}
......
{
"name": "uview-ui",
"version": "1.2.3",
"version": "1.2.5",
"description": "uView UI,是uni-app生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
"main": "index.js",
"keywords": ["uview", "uView", "uni-app", "uni-app ui", "uniapp", "uviewui", "uview ui", "uviewUI", "uViewui", "uViewUI", "uView UI", "uni ui", "uni UI", "uniapp ui", "ui", "UI框架", "uniapp ui框架", "uniapp UI"],
......
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