Commit 3765301b authored by wlxuqu's avatar wlxuqu

1. 1.3.3起,numberBox步进器推荐使用v-model双向绑定数值,无需在change回调中重新赋值

2. search组件新增clear清除内容事件
3. 优化程序选择模板在微信小程序上的问题
4. 优化countTo组件可能由于传入字符串数值而报错的问题
5. 由于form表单验证在某些表单域没有验证规则导致不会触发验证回调的问题
6. section组件新增可控制左边竖条的show-line参数
7. 优化验证码倒计时组件可能会触发多次的问题
parent 1043b6a9
......@@ -2,14 +2,14 @@
"easycom": {
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
// "condition": { //模式配置,仅开发期间生效
// "current": 0, //当前激活的模式(list 的索引项)
// "list": [{
// "name": "test", //模式名称
// "path": "pages/components/changelog.html", //启动页面,必选
// "query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到
// }]
// },
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [{
"name": "test", //模式名称
"path": "pages/template/citySelect/index", //启动页面,必选
"query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到
}]
},
"pages": [
// 演示-组件
{
......
......@@ -229,7 +229,7 @@ export default {
},
{
// 正则不能含有两边的引号
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{6,12}$/,
pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/,
message: '需同时含有字母和数字,长度在6-12之间',
trigger: ['change','blur'],
}
......@@ -394,7 +394,8 @@ export default {
if(this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: '正在获取验证码'
title: '正在获取验证码',
mask: true
})
setTimeout(() => {
uni.hideLoading();
......
<template>
</template>
<script>
</script>
<style>
</style>
......@@ -3,7 +3,7 @@
<view class="u-demo-wrap">
<view class="u-demo-title">演示效果</view>
<view class="u-demo-area">
<u-number-box :value="value" :bg-color="bgColor" :color="color" :min="0"
<u-number-box v-model="value" :bg-color="bgColor" :color="color" :min="0"
:step="step" :disabled="disabled" @change="change"></u-number-box>
</view>
</view>
......@@ -63,8 +63,7 @@ export default {
this.step = index == 0 ? 1 : index == 1 ? 3 : index == 2 ? 5 : 8;
},
change(e) {
// console.log(e);
// this.value = e.value;
// console.log(this.value);
}
}
};
......
<template>
<u-popup v-model="value" mode="bottom" :popup="false" :mask="true" :closeable="true" :safe-area-inset-bottom="true"
close-icon-color="#ffffff" :z-index="uZIndex" :maskCloseAble="maskCloseAble" @close="close">
<u-tabs :list="genTabsList" :is-scroll="true" :current="tabsIndex" @change="tabsChange" ref="tabs"></u-tabs>
<u-tabs v-if="value" :list="genTabsList" :is-scroll="true" :current="tabsIndex" @change="tabsChange" ref="tabs"></u-tabs>
<view class="area-box">
<view class="u-flex" :class="{ 'change':isChange }">
<view class="area-item">
......
......@@ -382,12 +382,12 @@ export default {
transform-origin: 0 0;
left: 0;
top: 0;
width: 200.1%;
height: 200.1%;
width: 199.8%;
height: 199.7%;
-webkit-transform: scale(0.5, 0.5);
transform: scale(0.5, 0.5);
border: 1px solid currentColor;
z-index: 0;
z-index: 1;
}
.u-bold-border {
......
......@@ -207,6 +207,8 @@ export default {
return !isNaN(parseFloat(val));
},
formatNumber(num) {
// 将num转为Number类型,因为其值可能为字符串数值,调用toFixed会报错
num = Number(num);
num = num.toFixed(Number(this.decimals));
num += '';
const x = num.split('.');
......
......@@ -210,8 +210,11 @@ export default {
validation(trigger, callback = () => {}) {
// blur和change是否有当前方式的校验规则
let rules = this.getFilteredRule(trigger);
// 判断是否有验证规则
if (!rules || rules.length === 0) return;
// 判断是否有验证规则,如果没有规则,也调用回调方法,否则父组件u-form会因为
// 对count变量的统计错误而无法进入上一层的回调
if (!rules || rules.length === 0) {
return callback('');
}
// 设置当前的装填,标识为校验中
this.validateState = 'validating';
// 调用async-validator的方法
......
......@@ -120,8 +120,9 @@
}
},
watch: {
value(val) {
this.inputVal = Number(val);
value(val, val1) {
// 防止用户在change事件回调中将回调值赋值给valut变量,导致change事件触发两次
if(Number(val) != this.inputVal) this.inputVal = Number(val);
},
inputVal(v1, v2) {
// 为了让用户能够删除所有输入值,重新输入内容,删除所有值后,内容为空字符串
......@@ -229,6 +230,8 @@
},
handleChange(value, type) {
if (this.disabled) return;
// 发出input事件,修改通过v-model绑定的值,达到双向绑定的效果
this.$emit('input', Number(value));
this.$emit(type, {
// 转为Number类型
value: Number(value),
......
......@@ -71,6 +71,7 @@
* @event {Function} change 输入框内容发生变化时触发
* @event {Function} search 用户确定搜索时触发,用户按回车键,或者手机键盘右下角的"搜索"键时触发
* @event {Function} custom 用户点击右侧控件时触发
* @event {Function} clear 用户点击清除按钮时触发
* @example <u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
*/
export default {
......@@ -230,6 +231,7 @@ export default {
// 也可以作为用户通过this.$refs形式调用清空输入框内容
clear() {
this.keyword = '';
this.$emit('clear');
},
// 确定搜索
search() {
......
......@@ -3,7 +3,10 @@
<view class="u-section-title" :style="{
fontWeight: bold ? 'bold' : 'normal',
color: color,
fontSize: fontSize + 'rpx'
fontSize: fontSize + 'rpx',
paddingLeft: showLine ? '10rpx' : 0
}" :class="{
'u-section--line': showLine
}">
{{title}}
</view>
......@@ -26,6 +29,7 @@
* @property {String} title 左边主标题
* @property {String} sub-title 右边副标题(默认更多)
* @property {Boolean} right 是否显示右边的内容(默认true)
* @property {Boolean} showLine 是否显示左边的竖条(默认true)
* @property {String Number} font-size 主标题的字体大小(默认28)
* @property {Boolean} bold 主标题是否加粗(默认true)
* @property {String} color 主标题颜色(默认#303133)
......@@ -68,6 +72,11 @@
subColor: {
type: String,
default: '#909399'
},
// 是否显示左边的竖条
showLine: {
type: Boolean,
default: false
}
},
data() {
......@@ -94,11 +103,10 @@
.u-section-title {
position: relative;
font-size: 28rpx;
padding-left: 10px;
line-height: 1;
}
.u-section-title:after {
.u-section--line:after {
position: absolute;
width: 4px;
height: 100%;
......
......@@ -87,6 +87,11 @@
},
// 开始倒计时
start() {
// 防止快速点击获取验证码的按钮而导致内部产生多个定时器导致混乱
if(this.timer) {
clearInterval(this.timer);
this.timer = null;
}
//this.secNum = this.seconds;
this.$emit('start');
this.canGetCode = false;
......@@ -98,6 +103,7 @@
this.changeEvent(this.changeText.replace(/x|X/, this.secNum));
} else {
clearInterval(this.timer);
this.timer = null;
this.changeEvent(this.endText);
this.secNum = this.seconds;
this.$emit('end');
......
......@@ -134,11 +134,11 @@ u-grid {
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
// 多加0.1%,能解决有时候边框缺失的问题
width: 200.1%;
height: 200.1%;
width: 199.8%;
height: 199.7%;
transform: scale(0.5, 0.5);
border: 0 solid $u-border-color;
z-index: 1;
z-index: 2;
}
.u-border-top:after {
......
// 此版本发布于2020-06-09
let version = '1.3.2';
// 此版本发布于2020-06-10
let version = '1.3.3';
export default {
v: version,
......
......@@ -8,11 +8,11 @@ class Request {
}
// 主要请求部分
async request(options = {}) {
request(options = {}) {
// 检查请求拦截
if (this.interceptor.request && typeof this.interceptor.request === 'function') {
let tmpConfig = {};
let interceptorReuest = await this.interceptor.request(options);
let interceptorReuest = this.interceptor.request(options);
if (interceptorReuest === false) {
return false;
}
......@@ -27,7 +27,7 @@ class Request {
options.method = options.method || this.config.method;
return new Promise((resolve, reject) => {
options.complete = async (response) => {
options.complete = (response) => {
// 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
uni.hideLoading();
// 清除定时器,如果请求回来了,就无需loading
......@@ -36,7 +36,7 @@ class Request {
if(this.config.originalData) {
// 判断是否存在拦截器
if (this.interceptor.response && typeof this.interceptor.response === 'function') {
let resInterceptors = await this.interceptor.response(response);
let resInterceptors = this.interceptor.response(response);
// 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
if (resInterceptors !== false) {
resolve(resInterceptors);
......@@ -51,11 +51,11 @@ class Request {
} else {
if (response.statusCode == 200) {
if (this.interceptor.response && typeof this.interceptor.response === 'function') {
let resInterceptors = await this.interceptor.response(response.data);
let resInterceptors = this.interceptor.response(response.data);
if (resInterceptors !== false) {
resolve(resInterceptors);
} else {
reject(resInterceptors);
reject(response.data);
}
} else {
// 如果不是返回原始数据(originalData=false),且没有拦截器的情况下,返回纯数据给then回调
......
{
"name": "uview-ui",
"version": "1.3.2",
"version": "1.3.3",
"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