Commit 40604f61 authored by wlxuqu's avatar wlxuqu

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. 由于加载问题,阿里,头条,百度小程序的图标改用线上资源
parent d8df8766
...@@ -105,7 +105,8 @@ ...@@ -105,7 +105,8 @@
"usingComponents" : true "usingComponents" : true
}, },
"mp-baidu" : { "mp-baidu" : {
"usingComponents" : true "usingComponents" : true,
"appid" : "17597421"
}, },
"mp-toutiao" : { "mp-toutiao" : {
"usingComponents" : true "usingComponents" : true
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// "current": 0, //当前激活的模式(list 的索引项) // "current": 0, //当前激活的模式(list 的索引项)
// "list": [{ // "list": [{
// "name": "test", //模式名称 // "name": "test", //模式名称
// "path": "pages/componentsA/form/index", //启动页面,必选 // "path": "pages/components/changelog.html", //启动页面,必选
// "query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到 // "query": "id=1&name=2" //启动参数,在页面的onLoad函数里面得到
// }] // }]
// }, // },
......
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
<view class="u-demo-wrap" style="background-color: #FFFFFF;"> <view class="u-demo-wrap" style="background-color: #FFFFFF;">
<view class="u-demo-title">演示效果</view> <view class="u-demo-title">演示效果</view>
<view class="u-demo-area"> <view class="u-demo-area">
<u-calendar v-model="show" :minDate="minDate" :maxDate="maxDate" :btnType="btnType" :activeBgColor="activeBgColor" <u-calendar v-model="show" ref="calendar" @change="change" :mode="mode"
:rangeBgColor="rangeBgColor" :rangeColor="rangeColor" :startText="startText" :endText="endText" :arrowType="arrowType" :start-text="startText" :end-text="endText" :range-color="rangeColor"
:mode="mode" ref="calendar" @change="change"> :range-bg-color="rangeBgColor" :active-bg-color="activeBgColor" :btn-type="btnType"
>
</u-calendar> </u-calendar>
<view class="u-demo-result-line">
{{result}}
</view>
</view> </view>
</view> </view>
<view class="u-config-wrap"> <view class="u-config-wrap">
...@@ -19,20 +22,12 @@ ...@@ -19,20 +22,12 @@
<u-subsection vibrateShort :current="showBtnStatus" :list="['显示', '隐藏']" @change="showChange"></u-subsection> <u-subsection vibrateShort :current="showBtnStatus" :list="['显示', '隐藏']" @change="showChange"></u-subsection>
</view> </view>
<view class="u-config-item"> <view class="u-config-item">
<view class="u-item-title">显示错误信息</view> <view class="u-item-title">模式</view>
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="errorMessageChange"></u-subsection> <u-subsection vibrateShort current="1" :list="['单个日期', '日期范围']" @change="modeChange"></u-subsection>
</view> </view>
<view class="u-config-item"> <view class="u-config-item">
<view class="u-item-title">是否必填</view> <view class="u-item-title">自定义样式</view>
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="requiredChange"></u-subsection> <u-subsection vibrateShort current="1" :list="['是', '否']" @change="styleChange"></u-subsection>
</view>
<view class="u-config-item">
<view class="u-item-title">显示左图标和右箭头</view>
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="customChange"></u-subsection>
</view>
<view class="u-config-item">
<view class="u-item-title">第一个输入框为textarea类型</view>
<u-subsection vibrateShort current="1" :list="['是', '否']" @change="textareaChange"></u-subsection>
</view> </view>
</view> </view>
</view> </view>
...@@ -44,16 +39,13 @@ ...@@ -44,16 +39,13 @@
return { return {
show: false, show: false,
mode: 'range', mode: 'range',
arrowType: 1, result: "请选择日期",
minDate: "1920-01-01", startText: '开始',
maxDate: "", endText: '结束',
btnType: "primary", rangeColor: '#2979ff',
activeBgColor: "#2979ff", rangeBgColor: 'rgba(41,121,255,0.13)',
rangeBgColor: "rgba(41,121,255,0.13)", activeBgColor: '#2979ff',
rangeColor: "#2979ff", btnType: 'primary',
startText: "开始",
endText: "结束",
result: ""
} }
}, },
computed: { computed: {
...@@ -65,11 +57,27 @@ ...@@ -65,11 +57,27 @@
showChange(index) { showChange(index) {
this.show = !index; this.show = !index;
}, },
errorMessageChange(index) { modeChange(index) {
this.errorMessage = index == 0 ? '手机号有误' : false this.mode = index == 0 ? 'date' : 'range';
this.show = true;
}, },
requiredChange(index) { styleChange(index) {
this.required = index == 0 ? true : false; if(index == 0) {
this.startText = '住店';
this.endText = '离店';
this.activeBgColor = '#19be6b';
this.rangeColor = '#19be6b';
this.rangeBgColor = 'rgba(25,190,107, 0.13)';
this.btnType = 'success';
} else {
this.startText = '开始';
this.endText = '结束';
this.activeBgColor = '#2979ff';
this.rangeColor = '#2979ff';
this.rangeBgColor = 'rgba(41,121,255,0.13)';
this.btnType = 'primary';
}
this.show = true;
}, },
customChange(index) { customChange(index) {
if(index == 0) { if(index == 0) {
...@@ -86,11 +94,10 @@ ...@@ -86,11 +94,10 @@
this.type = index == 0 ? 'textarea' : 'text'; this.type = index == 0 ? 'textarea' : 'text';
}, },
change(e) { change(e) {
console.log(e) if (this.mode == 'range') {
if (this.type == 1) { this.result = e.startDate + " - " + e.endDate;
this.result = e.result
} else { } else {
this.result = `${e.startDate}${e.endDate}` this.result = e.result;
} }
} }
} }
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
</view> </view>
<view class="u-config-wrap"> <view class="u-config-wrap">
<view class="u-config-title u-border-bottom">参数配置</view> <view class="u-config-title u-border-bottom">参数配置</view>
<view class="u-config-item">
<view class="u-item-title">状态</view>
<u-subsection vibrateShort :current="current" :list="['打开', '收起']" @change="statusChange"></u-subsection>
</view>
<view class="u-config-item"> <view class="u-config-item">
<view class="u-item-title">模式</view> <view class="u-item-title">模式</view>
<u-subsection vibrateShort :list="['单列', '多列独立', '多列联动']" @change="modeChange"></u-subsection> <u-subsection vibrateShort :list="['单列', '多列独立', '多列联动']" @change="modeChange"></u-subsection>
...@@ -173,6 +177,9 @@ export default { ...@@ -173,6 +177,9 @@ export default {
} }
}, },
methods: { methods: {
statusChange(index) {
this.show = !index;
},
modeChange(index) { modeChange(index) {
let type = ['single-column', 'mutil-column', 'mutil-column-auto']; let type = ['single-column', 'mutil-column', 'mutil-column-auto'];
this.mode = type[index]; this.mode = type[index];
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<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 :value="value" :bg-color="bgColor" :color="color" :min="0"
:step="step" :disabled="disabled"></u-number-box> :step="step" :disabled="disabled" @change="change"></u-number-box>
</view> </view>
</view> </view>
<view class="u-config-wrap"> <view class="u-config-wrap">
...@@ -63,7 +63,8 @@ export default { ...@@ -63,7 +63,8 @@ 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) {
this.value = e.value; // console.log(e);
// this.value = e.value;
} }
} }
}; };
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<u-cell-group> <u-cell-group>
<u-cell-item v-for="(item,index) in provinces" :title="item.label" :arrow="false" :index="index" :key="index" <u-cell-item v-for="(item,index) in provinces" :title="item.label" :arrow="false" :index="index" :key="index"
@click="provinceChange"> @click="provinceChange">
<u-icon v-show="isChooseP&&province===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon> <u-icon v-if="isChooseP&&province===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
</u-cell-item> </u-cell-item>
</u-cell-group> </u-cell-group>
</scroll-view> </scroll-view>
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
<view class="area-item"> <view class="area-item">
<view class="u-padding-10 u-bg-gray" style="height: 100%;"> <view class="u-padding-10 u-bg-gray" style="height: 100%;">
<scroll-view :scroll-y="true" style="height: 100%"> <scroll-view :scroll-y="true" style="height: 100%">
<u-cell-group v-show="isChooseP"> <u-cell-group v-if="isChooseP">
<u-cell-item v-for="(item,index) in citys" :title="item.label" :arrow="false" :index="index" :key="index" <u-cell-item v-for="(item,index) in citys" :title="item.label" :arrow="false" :index="index" :key="index"
@click="cityChange"> @click="cityChange">
<u-icon v-show="isChooseC&&city===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon> <u-icon v-if="isChooseC&&city===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
</u-cell-item> </u-cell-item>
</u-cell-group> </u-cell-group>
</scroll-view> </scroll-view>
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
<view class="area-item"> <view class="area-item">
<view class="u-padding-10 u-bg-gray" style="height: 100%;"> <view class="u-padding-10 u-bg-gray" style="height: 100%;">
<scroll-view :scroll-y="true" style="height: 100%"> <scroll-view :scroll-y="true" style="height: 100%">
<u-cell-group v-show="isChooseC"> <u-cell-group v-if="isChooseC">
<u-cell-item v-for="(item,index) in areas" :title="item.label" :arrow="false" :index="index" :key="index" <u-cell-item v-for="(item,index) in areas" :title="item.label" :arrow="false" :index="index" :key="index"
@click="areaChange"> @click="areaChange">
<u-icon v-show="isChooseA&&area===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon> <u-icon v-if="isChooseA&&area===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
</u-cell-item> </u-cell-item>
</u-cell-group> </u-cell-group>
</scroll-view> </scroll-view>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view class="u-navbar-inner" :style="[navbarInnerStyle]"> <view class="u-navbar-inner" :style="[navbarInnerStyle]">
<view class="u-back-wrap" v-if="isBack" @tap="goBack"> <view class="u-back-wrap" v-if="isBack" @tap="goBack">
<view class="u-icon-wrap"> <view class="u-icon-wrap">
<u-icon @click="goBack" :name="backIconName" :color="backIconColor" :size="backIconSize"></u-icon> <u-icon :name="backIconName" :color="backIconColor" :size="backIconSize"></u-icon>
</view> </view>
<view class="u-icon-wrap u-back-text u-line-1" v-if="backText" :style="[backTextStyle]"> <view class="u-icon-wrap u-back-text u-line-1" v-if="backText" :style="[backTextStyle]">
{{backText}} {{backText}}
......
...@@ -230,7 +230,8 @@ ...@@ -230,7 +230,8 @@
handleChange(value, type) { handleChange(value, type) {
if (this.disabled) return; if (this.disabled) return;
this.$emit(type, { this.$emit(type, {
value: value, // 转为Number类型
value: Number(value),
index: this.index index: this.index
}) })
} }
......
<template> <template>
<view class=""> <view class="">
<view class="u-content" :style="{ height: isLongContent && !showMore ? showHeight + 'px' : 'auto' }"> <view class="u-content" :style="{ height: isLongContent && !showMore ? showHeight + 'rpx' : 'auto' }">
<slot></slot> <slot></slot>
</view> </view>
<view @tap="toggleReadMore" v-if="isLongContent" class="u-showmore-wrap" <view @tap="toggleReadMore" v-if="isLongContent" class="u-showmore-wrap"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
export default { export default {
name: "u-read-more", name: "u-read-more",
props: { props: {
// 默认的显示占位高度,单位为px // 默认的显示占位高度,单位为rpx
showHeight: { showHeight: {
type: [Number, String], type: [Number, String],
default: 400 default: 400
...@@ -102,19 +102,13 @@ ...@@ -102,19 +102,13 @@
}, },
methods: { methods: {
init() { init() {
const query = uni.createSelectorQuery(this).in(this); this.$uGetRect('.u-content').then(res => {
query // 判断高度,如果真实内容高度大于占位高度,则显示收起与展开的控制按钮
.select('.u-content') if (res.height > uni.upx2px(this.showHeight)) {
.boundingClientRect(res => { this.isLongContent = true;
if (res) { this.showMore = false;
// 判断高度,如果真实内容高度大于占位高度,则显示收起与展开的控制按钮 }
if (res.height > this.showHeight) { })
this.isLongContent = true;
this.showMore = false;
}
}
})
.exec();
}, },
// 展开或者收起 // 展开或者收起
toggleReadMore() { toggleReadMore() {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
}, inputStyle]" }, inputStyle]"
/> />
<view class="u-close-wrap" v-if="keyword && clearabled && focused" @touchstart="clear"> <view class="u-close-wrap" v-if="keyword && clearabled && focused" @touchstart="clear">
<u-icon class="u-clear-icon" name="close" :size="16" color="#fff" @touchstart="clear"></u-icon> <u-icon class="u-clear-icon" name="close-circle-fill" size="34" color="#c0c4cc"></u-icon>
</view> </view>
</view> </view>
<view :style="[actionStyle]" class="u-action" <view :style="[actionStyle]" class="u-action"
...@@ -288,12 +288,11 @@ export default { ...@@ -288,12 +288,11 @@ export default {
} }
.u-close-wrap { .u-close-wrap {
width: 34rpx; width: 40rpx;
height: 34rpx; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: rgb(200, 203, 204);
border-radius: 50%; border-radius: 50%;
} }
......
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
setSelectValue() { setSelectValue() {
for(let i = 0; i < this.columnNum; i++) { for(let i = 0; i < this.columnNum; i++) {
this.selectValue.push({ this.selectValue.push({
valut: this.columnData[i][this.defaultSelector[i]].value, value: this.columnData[i][this.defaultSelector[i]].value,
label: this.columnData[i][this.defaultSelector[i]].label, label: this.columnData[i][this.defaultSelector[i]].label,
}) })
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view class="u-slider__button-wrap" @touchstart="onTouchStart" <view class="u-slider__button-wrap" @touchstart="onTouchStart"
@touchmove="onTouchMove" @touchend="onTouchEnd" @touchmove="onTouchMove" @touchend="onTouchEnd"
@touchcancel="onTouchEnd"> @touchcancel="onTouchEnd">
<slot v-if="useSlot"/> <slot v-if="$slots.default"/>
<view v-else class="u-slider__button" :style="[blockStyle, { <view v-else class="u-slider__button" :style="[blockStyle, {
height: blockWidth + 'rpx', height: blockWidth + 'rpx',
width: blockWidth + 'rpx' width: blockWidth + 'rpx'
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
* @property {String} blockColor 滑块颜色(默认#ffffff) * @property {String} blockColor 滑块颜色(默认#ffffff)
* @property {Object} blockStyle 给滑块自定义样式,对象形式 * @property {Object} blockStyle 给滑块自定义样式,对象形式
* @property {Boolean} disabled 是否禁用滑块(默认为false) * @property {Boolean} disabled 是否禁用滑块(默认为false)
* @property {Boolean} useSlot 是否使用slot传入自定义滑块(默认为false)
* @event {Function} start 滑动触发 * @event {Function} start 滑动触发
* @event {Function} moving 正在滑动中 * @event {Function} moving 正在滑动中
* @event {Function} end 滑动结束 * @event {Function} end 滑动结束
...@@ -106,11 +105,6 @@ export default { ...@@ -106,11 +105,6 @@ export default {
return {}; return {};
} }
}, },
// 是否传入自定义的按钮slot
useSlot: {
type: Boolean,
default: false
}
}, },
data() { data() {
return { return {
......
...@@ -126,9 +126,9 @@ export default { ...@@ -126,9 +126,9 @@ export default {
mounted() { mounted() {
this.getActionRect(); this.getActionRect();
// 等视图更新完后,再显示右边的可滑动按钮,防止这些按钮会"闪一下" // 等视图更新完后,再显示右边的可滑动按钮,防止这些按钮会"闪一下"
this.$nextTick(() => { setTimeout(() => {
this.showBtn = true; this.showBtn = true;
}) }, 10);
}, },
methods: { methods: {
// 点击按钮 // 点击按钮
......
<template> <template>
<view class="u-swiper-wrap" :style="{ <view class="u-swiper-wrap" :style="{
borderRadius: `${borderRadius}rpx`, borderRadius: `${borderRadius}rpx`
backgroundColor: bgColor
}"> }">
<swiper @change="change" @animationfinish="animationfinish" :interval="interval" :circular="circular" :duration="duration" :autoplay="autoplay" <swiper @change="change" @animationfinish="animationfinish" :interval="interval" :circular="circular" :duration="duration" :autoplay="autoplay"
:previous-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :next-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :previous-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'" :next-margin="effect3d ? effect3dPreviousMargin + 'rpx' : '0'"
...@@ -12,7 +11,8 @@ ...@@ -12,7 +11,8 @@
<view class="u-list-image-wrap" :class="[current != index ? 'u-list-scale' : '']" :style="{ <view class="u-list-image-wrap" :class="[current != index ? 'u-list-scale' : '']" :style="{
borderRadius: `${borderRadius}rpx`, borderRadius: `${borderRadius}rpx`,
transform: effect3d && current != index ? 'scaleY(0.9)' : 'scaleY(1)', transform: effect3d && current != index ? 'scaleY(0.9)' : 'scaleY(1)',
margin: effect3d && current != index ? '0 20rpx' : 0 margin: effect3d && current != index ? '0 20rpx' : 0,
backgroundColor: bgColor
}"> }">
<image class="u-swiper-image" :src="item[name]" :mode="imgMode"></image> <image class="u-swiper-image" :src="item[name]" :mode="imgMode"></image>
<view v-if="title" class="u-swiper-title u-line-1" :style="{ <view v-if="title" class="u-swiper-title u-line-1" :style="{
...@@ -158,6 +158,12 @@ ...@@ -158,6 +158,12 @@
default: '#f3f4f6' default: '#f3f4f6'
} }
}, },
watch: {
// 如果外部的list发生变化,判断长度是否被修改,如果前后长度不一致,重置current值,避免溢出
list(nVal, oVal) {
if(nVal.length !== oVal.length) this.current = 0;
}
},
data() { data() {
return { return {
current: 0 // 当前活跃的swiper-item的index current: 0 // 当前活跃的swiper-item的index
......
This diff is collapsed.
// 此版本发布于2020-05-26 // 此版本发布于2020-06-09
let version = '1.2.9'; let version = '1.3.2';
export default { export default {
v: version, v: version,
......
...@@ -16,7 +16,7 @@ function mobile(value) { ...@@ -16,7 +16,7 @@ function mobile(value) {
* 验证URL格式 * 验证URL格式
*/ */
function url(value) { function url(value) {
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 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_!~*'().;?:@&=+$,%#-]+)+\/?)$/
.test(value) .test(value)
} }
......
...@@ -99,7 +99,6 @@ class Request { ...@@ -99,7 +99,6 @@ class Request {
// 默认的请求头 // 默认的请求头
header: { header: {
'content-type': 'application/json;charset=UTF-8', 'content-type': 'application/json;charset=UTF-8',
'version': 1
}, },
method: 'POST', method: 'POST',
// 设置为json,返回后uni.request会对数据进行一次JSON.parse // 设置为json,返回后uni.request会对数据进行一次JSON.parse
......
{ {
"name": "uview-ui", "name": "uview-ui",
"version": "1.3.0", "version": "1.3.2",
"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