Skip to content

Commit 40604f6

Browse files
committed
1. 优化this.$u.test.url()URL检测方法正则无法识别"127.0.0.1"的缺陷
2. 优化Swiper轮播图组件动态修改list长度时,重置内部current值 3. 移除Slider滑块组件的use-slot参数,改由组件内部判断,原功能不受影响 4. 完善文档Select组件关于回调参数的说明,完善日历组件的演示效果 5. 修复http请求可能存在导致跨域的问题 6. 新增双箭头图标arrow-left-double和arrow-right-double 7. 增加Search搜索组件右边清除按钮的可点击区域 8. 修复navBar返回按钮可能会触发两次的问题 9. 由于加载问题,阿里,头条,百度小程序的图标改用线上资源
1 parent d8df876 commit 40604f6

File tree

19 files changed

+100
-91
lines changed

19 files changed

+100
-91
lines changed

manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@
105105
"usingComponents" : true
106106
},
107107
"mp-baidu" : {
108-
"usingComponents" : true
108+
"usingComponents" : true,
109+
"appid" : "17597421"
109110
},
110111
"mp-toutiao" : {
111112
"usingComponents" : true

pages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// "current": 0, //当前激活的模式(list 的索引项)
77
// "list": [{
88
// "name": "test", //模式名称
9-
// "path": "pages/componentsA/form/index", //启动页面,必选
9+
// "path": "pages/components/changelog.html", //启动页面,必选
1010
// "query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到
1111
// }]
1212
// },

pages/componentsA/calendar/index.vue

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
<view class="u-demo-wrap" style="background-color: #FFFFFF;">
44
<view class="u-demo-title">演示效果</view>
55
<view class="u-demo-area">
6-
<u-calendar v-model="show" :minDate="minDate" :maxDate="maxDate" :btnType="btnType" :activeBgColor="activeBgColor"
7-
:rangeBgColor="rangeBgColor" :rangeColor="rangeColor" :startText="startText" :endText="endText" :arrowType="arrowType"
8-
:mode="mode" ref="calendar" @change="change">
9-
6+
<u-calendar v-model="show" ref="calendar" @change="change" :mode="mode"
7+
:start-text="startText" :end-text="endText" :range-color="rangeColor"
8+
:range-bg-color="rangeBgColor" :active-bg-color="activeBgColor" :btn-type="btnType"
9+
>
1010
</u-calendar>
11+
<view class="u-demo-result-line">
12+
{{result}}
13+
</view>
1114
</view>
1215
</view>
1316
<view class="u-config-wrap">
@@ -19,20 +22,12 @@
1922
<u-subsection vibrateShort :current="showBtnStatus" :list="['显示', '隐藏']" @change="showChange"></u-subsection>
2023
</view>
2124
<view class="u-config-item">
22-
<view class="u-item-title">显示错误信息</view>
23-
<u-subsection vibrateShort current="1" :list="['', '']" @change="errorMessageChange"></u-subsection>
25+
<view class="u-item-title">模式</view>
26+
<u-subsection vibrateShort current="1" :list="['单个日期', '日期范围']" @change="modeChange"></u-subsection>
2427
</view>
2528
<view class="u-config-item">
26-
<view class="u-item-title">是否必填</view>
27-
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="requiredChange"></u-subsection>
28-
</view>
29-
<view class="u-config-item">
30-
<view class="u-item-title">显示左图标和右箭头</view>
31-
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="customChange"></u-subsection>
32-
</view>
33-
<view class="u-config-item">
34-
<view class="u-item-title">第一个输入框为textarea类型</view>
35-
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="textareaChange"></u-subsection>
29+
<view class="u-item-title">自定义样式</view>
30+
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="styleChange"></u-subsection>
3631
</view>
3732
</view>
3833
</view>
@@ -44,16 +39,13 @@
4439
return {
4540
show: false,
4641
mode: 'range',
47-
arrowType: 1,
48-
minDate: "1920-01-01",
49-
maxDate: "",
50-
btnType: "primary",
51-
activeBgColor: "#2979ff",
52-
rangeBgColor: "rgba(41,121,255,0.13)",
53-
rangeColor: "#2979ff",
54-
startText: "开始",
55-
endText: "结束",
56-
result: ""
42+
result: "请选择日期",
43+
startText: '开始',
44+
endText: '结束',
45+
rangeColor: '#2979ff',
46+
rangeBgColor: 'rgba(41,121,255,0.13)',
47+
activeBgColor: '#2979ff',
48+
btnType: 'primary',
5749
}
5850
},
5951
computed: {
@@ -65,11 +57,27 @@
6557
showChange(index) {
6658
this.show = !index;
6759
},
68-
errorMessageChange(index) {
69-
this.errorMessage = index == 0 ? '手机号有误' : false
60+
modeChange(index) {
61+
this.mode = index == 0 ? 'date' : 'range';
62+
this.show = true;
7063
},
71-
requiredChange(index) {
72-
this.required = index == 0 ? true : false;
64+
styleChange(index) {
65+
if(index == 0) {
66+
this.startText = '住店';
67+
this.endText = '离店';
68+
this.activeBgColor = '#19be6b';
69+
this.rangeColor = '#19be6b';
70+
this.rangeBgColor = 'rgba(25,190,107, 0.13)';
71+
this.btnType = 'success';
72+
} else {
73+
this.startText = '开始';
74+
this.endText = '结束';
75+
this.activeBgColor = '#2979ff';
76+
this.rangeColor = '#2979ff';
77+
this.rangeBgColor = 'rgba(41,121,255,0.13)';
78+
this.btnType = 'primary';
79+
}
80+
this.show = true;
7381
},
7482
customChange(index) {
7583
if(index == 0) {
@@ -86,11 +94,10 @@
8694
this.type = index == 0 ? 'textarea' : 'text';
8795
},
8896
change(e) {
89-
console.log(e)
90-
if (this.type == 1) {
91-
this.result = e.result
97+
if (this.mode == 'range') {
98+
this.result = e.startDate + " - " + e.endDate;
9299
} else {
93-
this.result = `${e.startDate}${e.endDate}`
100+
this.result = e.result;
94101
}
95102
}
96103
}

pages/componentsA/select/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
</view>
1010
<view class="u-config-wrap">
1111
<view class="u-config-title u-border-bottom">参数配置</view>
12+
<view class="u-config-item">
13+
<view class="u-item-title">状态</view>
14+
<u-subsection vibrateShort :current="current" :list="['打开', '收起']" @change="statusChange"></u-subsection>
15+
</view>
1216
<view class="u-config-item">
1317
<view class="u-item-title">模式</view>
1418
<u-subsection vibrateShort :list="['单列', '多列独立', '多列联动']" @change="modeChange"></u-subsection>
@@ -173,6 +177,9 @@ export default {
173177
}
174178
},
175179
methods: {
180+
statusChange(index) {
181+
this.show = !index;
182+
},
176183
modeChange(index) {
177184
let type = ['single-column', 'mutil-column', 'mutil-column-auto'];
178185
this.mode = type[index];

pages/componentsC/numberBox/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<view class="u-demo-title">演示效果</view>
55
<view class="u-demo-area">
66
<u-number-box :value="value" :bg-color="bgColor" :color="color" :min="0"
7-
:step="step" :disabled="disabled"></u-number-box>
7+
:step="step" :disabled="disabled" @change="change"></u-number-box>
88
</view>
99
</view>
1010
<view class="u-config-wrap">
@@ -63,7 +63,8 @@ export default {
6363
this.step = index == 0 ? 1 : index == 1 ? 3 : index == 2 ? 5 : 8;
6464
},
6565
change(e) {
66-
this.value = e.value;
66+
// console.log(e);
67+
// this.value = e.value;
6768
}
6869
}
6970
};

pages/template/citySelect/u-city-select.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<u-cell-group>
1111
<u-cell-item v-for="(item,index) in provinces" :title="item.label" :arrow="false" :index="index" :key="index"
1212
@click="provinceChange">
13-
<u-icon v-show="isChooseP&&province===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
13+
<u-icon v-if="isChooseP&&province===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
1414
</u-cell-item>
1515
</u-cell-group>
1616
</scroll-view>
@@ -19,10 +19,10 @@
1919
<view class="area-item">
2020
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
2121
<scroll-view :scroll-y="true" style="height: 100%">
22-
<u-cell-group v-show="isChooseP">
22+
<u-cell-group v-if="isChooseP">
2323
<u-cell-item v-for="(item,index) in citys" :title="item.label" :arrow="false" :index="index" :key="index"
2424
@click="cityChange">
25-
<u-icon v-show="isChooseC&&city===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
25+
<u-icon v-if="isChooseC&&city===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
2626
</u-cell-item>
2727
</u-cell-group>
2828
</scroll-view>
@@ -32,10 +32,10 @@
3232
<view class="area-item">
3333
<view class="u-padding-10 u-bg-gray" style="height: 100%;">
3434
<scroll-view :scroll-y="true" style="height: 100%">
35-
<u-cell-group v-show="isChooseC">
35+
<u-cell-group v-if="isChooseC">
3636
<u-cell-item v-for="(item,index) in areas" :title="item.label" :arrow="false" :index="index" :key="index"
3737
@click="areaChange">
38-
<u-icon v-show="isChooseA&&area===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
38+
<u-icon v-if="isChooseA&&area===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
3939
</u-cell-item>
4040
</u-cell-group>
4141
</scroll-view>

uview-ui/components/u-navbar/u-navbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<view class="u-navbar-inner" :style="[navbarInnerStyle]">
66
<view class="u-back-wrap" v-if="isBack" @tap="goBack">
77
<view class="u-icon-wrap">
8-
<u-icon @click="goBack" :name="backIconName" :color="backIconColor" :size="backIconSize"></u-icon>
8+
<u-icon :name="backIconName" :color="backIconColor" :size="backIconSize"></u-icon>
99
</view>
1010
<view class="u-icon-wrap u-back-text u-line-1" v-if="backText" :style="[backTextStyle]">
1111
{{backText}}

uview-ui/components/u-number-box/u-number-box.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@
230230
handleChange(value, type) {
231231
if (this.disabled) return;
232232
this.$emit(type, {
233-
value: value,
233+
// 转为Number类型
234+
value: Number(value),
234235
index: this.index
235236
})
236237
}

uview-ui/components/u-read-more/u-read-more.vue

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<view class="">
3-
<view class="u-content" :style="{ height: isLongContent && !showMore ? showHeight + 'px' : 'auto' }">
3+
<view class="u-content" :style="{ height: isLongContent && !showMore ? showHeight + 'rpx' : 'auto' }">
44
<slot></slot>
55
</view>
66
<view @tap="toggleReadMore" v-if="isLongContent" class="u-showmore-wrap"
@@ -34,7 +34,7 @@
3434
export default {
3535
name: "u-read-more",
3636
props: {
37-
// 默认的显示占位高度,单位为px
37+
// 默认的显示占位高度,单位为rpx
3838
showHeight: {
3939
type: [Number, String],
4040
default: 400
@@ -102,19 +102,13 @@
102102
},
103103
methods: {
104104
init() {
105-
const query = uni.createSelectorQuery(this).in(this);
106-
query
107-
.select('.u-content')
108-
.boundingClientRect(res => {
109-
if (res) {
110-
// 判断高度,如果真实内容高度大于占位高度,则显示收起与展开的控制按钮
111-
if (res.height > this.showHeight) {
112-
this.isLongContent = true;
113-
this.showMore = false;
114-
}
115-
}
116-
})
117-
.exec();
105+
this.$uGetRect('.u-content').then(res => {
106+
// 判断高度,如果真实内容高度大于占位高度,则显示收起与展开的控制按钮
107+
if (res.height > uni.upx2px(this.showHeight)) {
108+
this.isLongContent = true;
109+
this.showMore = false;
110+
}
111+
})
118112
},
119113
// 展开或者收起
120114
toggleReadMore() {

uview-ui/components/u-search/u-search.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}, inputStyle]"
3434
/>
3535
<view class="u-close-wrap" v-if="keyword && clearabled && focused" @touchstart="clear">
36-
<u-icon class="u-clear-icon" name="close" :size="16" color="#fff" @touchstart="clear"></u-icon>
36+
<u-icon class="u-clear-icon" name="close-circle-fill" size="34" color="#c0c4cc"></u-icon>
3737
</view>
3838
</view>
3939
<view :style="[actionStyle]" class="u-action"
@@ -288,12 +288,11 @@ export default {
288288
}
289289
290290
.u-close-wrap {
291-
width: 34rpx;
292-
height: 34rpx;
291+
width: 40rpx;
292+
height: 100%;
293293
display: flex;
294294
align-items: center;
295295
justify-content: center;
296-
background-color: rgb(200, 203, 204);
297296
border-radius: 50%;
298297
}
299298

uview-ui/components/u-select/u-select.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export default {
193193
setSelectValue() {
194194
for(let i = 0; i < this.columnNum; i++) {
195195
this.selectValue.push({
196-
valut: this.columnData[i][this.defaultSelector[i]].value,
196+
value: this.columnData[i][this.defaultSelector[i]].value,
197197
label: this.columnData[i][this.defaultSelector[i]].label,
198198
})
199199
}

uview-ui/components/u-slider/u-slider.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<view class="u-slider__button-wrap" @touchstart="onTouchStart"
1616
@touchmove="onTouchMove" @touchend="onTouchEnd"
1717
@touchcancel="onTouchEnd">
18-
<slot v-if="useSlot"/>
18+
<slot v-if="$slots.default"/>
1919
<view v-else class="u-slider__button" :style="[blockStyle, {
2020
height: blockWidth + 'rpx',
2121
width: blockWidth + 'rpx'
@@ -40,7 +40,6 @@
4040
* @property {String} blockColor 滑块颜色(默认#ffffff)
4141
* @property {Object} blockStyle 给滑块自定义样式,对象形式
4242
* @property {Boolean} disabled 是否禁用滑块(默认为false)
43-
* @property {Boolean} useSlot 是否使用slot传入自定义滑块(默认为false)
4443
* @event {Function} start 滑动触发
4544
* @event {Function} moving 正在滑动中
4645
* @event {Function} end 滑动结束
@@ -106,11 +105,6 @@ export default {
106105
return {};
107106
}
108107
},
109-
// 是否传入自定义的按钮slot
110-
useSlot: {
111-
type: Boolean,
112-
default: false
113-
}
114108
},
115109
data() {
116110
return {

uview-ui/components/u-swipe-action/u-swipe-action.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ export default {
126126
mounted() {
127127
this.getActionRect();
128128
// 等视图更新完后,再显示右边的可滑动按钮,防止这些按钮会"闪一下"
129-
this.$nextTick(() => {
129+
setTimeout(() => {
130130
this.showBtn = true;
131-
})
131+
}, 10);
132132
},
133133
methods: {
134134
// 点击按钮

uview-ui/components/u-swiper/u-swiper.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<view class="u-swiper-wrap" :style="{
3-
borderRadius: `${borderRadius}rpx`,
4-
backgroundColor: bgColor
3+
borderRadius: `${borderRadius}rpx`
54
}">
65
<swiper @change="change" @animationfinish="animationfinish" :interval="interval" :circular="circular" :duration="duration" :autoplay="autoplay"
76
:previous-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :next-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'"
@@ -12,7 +11,8 @@
1211
<view class="u-list-image-wrap" :class="[current != index ? 'u-list-scale' : '']" :style="{
1312
borderRadius: `${borderRadius}rpx`,
1413
transform: effect3d && current != index ? 'scaleY(0.9)' : 'scaleY(1)',
15-
margin: effect3d && current != index ? '0 20rpx' : 0
14+
margin: effect3d && current != index ? '0 20rpx' : 0,
15+
backgroundColor: bgColor
1616
}">
1717
<image class="u-swiper-image" :src="item[name]" :mode="imgMode"></image>
1818
<view v-if="title" class="u-swiper-title u-line-1" :style="{
@@ -158,6 +158,12 @@
158158
default: '#f3f4f6'
159159
}
160160
},
161+
watch: {
162+
// 如果外部的list发生变化,判断长度是否被修改,如果前后长度不一致,重置current值,避免溢出
163+
list(nVal, oVal) {
164+
if(nVal.length !== oVal.length) this.current = 0;
165+
}
166+
},
161167
data() {
162168
return {
163169
current: 0 // 当前活跃的swiper-item的index

uview-ui/iconfont.css

Lines changed: 9 additions & 9 deletions
Large diffs are not rendered by default.

uview-ui/libs/config/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// 此版本发布于2020-05-26
2-
let version = '1.2.9';
1+
// 此版本发布于2020-06-09
2+
let version = '1.3.2';
33

44
export default {
55
v: version,

uview-ui/libs/function/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function mobile(value) {
1616
* 验证URL格式
1717
*/
1818
function url(value) {
19-
return /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i
19+
return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+\/?)$/
2020
.test(value)
2121
}
2222

0 commit comments

Comments
 (0)