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