Commit b3682c0f authored by wlxuqu's avatar wlxuqu

1. 【修复】修复numberbox组件可能会导致自动变化数值的问题

2. 【修复】修复rate组件颜色可能显示不对的问题
parent 31a991ae
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name" : "uView", "name" : "uView",
"appid" : "__UNI__60F4B81", "appid" : "__UNI__60F4B81",
"description" : "多平台快速开发的UI框架", "description" : "多平台快速开发的UI框架",
"versionName" : "1.7.2", "versionName" : "1.7.3",
"versionCode" : "100", "versionCode" : "100",
"transformPx" : false, "transformPx" : false,
"app-plus" : { "app-plus" : {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// "current": 0, //当前激活的模式(list 的索引项) // "current": 0, //当前激活的模式(list 的索引项)
// "list": [{ // "list": [{
// "name": "test", //模式名称 // "name": "test", //模式名称
// "path": "pages/componentsC/button/index", //启动页面,必选 // "path": "pages/componentsC/test/index", //启动页面,必选
// "query": "uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1" //启动参数,在页面的onLoad函数里面得到 // "query": "uuid=c4bba940-f69e-11ea-a419-6bafda9d095e&__id__=1" //启动参数,在页面的onLoad函数里面得到
// }] // }]
// }, // },
......
<template> <template>
<view class=""> <view class="wrap">
<u-checkbox-group @change="checkboxGroupChange"> <u-waterfall v-model="flowList" ref="uWaterfall">
<u-checkbox <template v-slot:left="{ leftList }">
@change="checkboxChange" <view class="demo-warter" v-for="(item, index) in leftList" :key="index">
v-model="item.checked" <view class="" @tap="click1(item)">
v-for="(item, index) in list" :key="index" <!-- 警告:微信小程序不支持嵌入lazyload组件,请自行如下使用image标签 -->
:name="item.name" <!-- #ifndef MP-WEIXIN -->
>{{item.name}}</u-checkbox> <u-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
</u-checkbox-group> <!-- #endif -->
<u-button @click="checkedAll">全选</u-button> <!-- #ifdef MP-WEIXIN -->
<view class="demo-img-wrap"><image class="demo-image" :src="item.image" mode="widthFix"></image></view>
<!-- #endif -->
<view class="demo-title">{{ item.title }}</view>
<view class="demo-price">{{ item.price }}</view>
<view class="demo-tag">
<view class="demo-tag-owner">自营</view>
<view class="demo-tag-text">放心购</view>
</view>
<view class="demo-shop">{{ item.shop }}</view>
<!-- 微信小程序无效,因为它不支持在template中引入组件 -->
<view class="u-close">
<u-icon name="close-circle-fill" color="#fa3534" size="34" @click="remove(item.id)"></u-icon>
</view>
</view>
</view>
</template>
<template v-slot:right="{ rightList }">
<view class="demo-warter" v-for="(item, index) in rightList" :key="index">
<!-- #ifndef MP-WEIXIN -->
<u-lazy-load threshold="-450" border-radius="10" :image="item.image" :index="index"></u-lazy-load>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="demo-img-wrap"><image class="demo-image" :src="item.image" mode="widthFix"></image></view>
<!-- #endif -->
<view class="demo-title">{{ item.title }}</view>
<view class="demo-price">{{ item.price }}</view>
<view class="demo-tag">
<view class="demo-tag-owner">自营</view>
<view class="demo-tag-text">放心购</view>
</view>
<view class="demo-shop">{{ item.shop }}</view>
<!-- 微信小程序无效,因为它不支持在template中引入组件 -->
<view class="u-close">
<u-icon name="close-circle-fill" color="#fa3534" size="34" @click="remove(item.id)"></u-icon>
</view>
</view>
</template>
</u-waterfall>
<u-loadmore bg-color="rgb(240, 240, 240)" :status="loadStatus" @loadmore="addRandomData"></u-loadmore>
</view> </view>
</template> </template>
...@@ -16,40 +55,186 @@ ...@@ -16,40 +55,186 @@
export default { export default {
data() { data() {
return { return {
loadStatus: 'loadmore',
flowList: [],
list: [ list: [
{ {
name: 'apple', price: 35,
checked: false, title: '北国风光,千里冰封,万里雪飘',
disabled: false shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23327_s.jpg'
}, },
{ {
name: 'banner', price: 75,
checked: false, title: '望长城内外,惟余莽莽',
disabled: false shop: '李白杜甫白居易旗舰店',
image: 'http://pic.sc.chinaz.com/Files/pic/pic9/202002/zzpic23325_s.jpg'
}, },
{ {
name: 'orange', price: 385,
checked: false, title: '大河上下,顿失滔滔',
disabled: false shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg'
},
{
price: 784,
title: '欲与天公试比高',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/zzpic23369_s.jpg'
},
{
price: 7891,
title: '须晴日,看红装素裹,分外妖娆',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2130_s.jpg'
},
{
price: 2341,
shop: '李白杜甫白居易旗舰店',
title: '江山如此多娇,引无数英雄竞折腰',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg'
},
{
price: 661,
shop: '李白杜甫白居易旗舰店',
title: '惜秦皇汉武,略输文采',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23344_s.jpg'
},
{
price: 1654,
title: '唐宗宋祖,稍逊风骚',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg'
},
{
price: 1678,
title: '一代天骄,成吉思汗',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg'
},
{
price: 924,
title: '只识弯弓射大雕',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg'
},
{
price: 8243,
title: '俱往矣,数风流人物,还看今朝',
shop: '李白杜甫白居易旗舰店',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23343_s.jpg'
} }
] ]
}; };
}, },
onLoad() {
this.addRandomData();
},
onReachBottom() {
this.loadStatus = 'loading';
// 模拟数据加载
setTimeout(() => {
this.addRandomData();
this.loadStatus = 'loadmore';
}, 1000);
},
methods: { methods: {
// 选中某个复选框时,由checkbox时触发 addRandomData() {
checkboxChange(e) { for (let i = 0; i < 10; i++) {
console.log(e); let index = this.$u.random(0, this.list.length - 1);
// 先转成字符串再转成对象,避免数组对象引用导致数据混乱
let item = JSON.parse(JSON.stringify(this.list[index]));
item.id = this.$u.guid();
this.flowList.push(item);
}
},
remove(id) {
this.$refs.uWaterfall.remove(id);
}, },
// 选中任一checkbox时,由checkbox-group触发 clear() {
checkboxGroupChange(e) { this.$refs.uWaterfall.clear();
// console.log(e);
}, },
// 全选 click1(item){
checkedAll() { console.log(item);
this.list.map(val => {
val.checked = true;
})
} }
} }
}; };
</script> </script>
\ No newline at end of file
<style>
/* page不能写带scope的style标签中,否则无效 */
page {
background-color: rgb(240, 240, 240);
}
</style>
<style lang="scss" scoped>
.demo-warter {
border-radius: 8px;
margin: 5px;
background-color: #ffffff;
padding: 8px;
position: relative;
}
.u-close {
position: absolute;
top: 32rpx;
right: 32rpx;
}
.demo-img-wrap {
}
.demo-image {
width: 100%;
border-radius: 4px;
}
.demo-title {
font-size: 30rpx;
margin-top: 5px;
color: $u-main-color;
}
.demo-tag {
display: flex;
margin-top: 5px;
}
.demo-tag-owner {
background-color: $u-type-error;
color: #ffffff;
display: flex;
align-items: center;
padding: 4rpx 14rpx;
border-radius: 50rpx;
font-size: 20rpx;
line-height: 1;
}
.demo-tag-text {
border: 1px solid $u-type-primary;
color: $u-type-primary;
margin-left: 10px;
border-radius: 50rpx;
line-height: 1;
padding: 4rpx 14rpx;
display: flex;
align-items: center;
border-radius: 50rpx;
font-size: 20rpx;
}
.demo-price {
font-size: 30rpx;
color: $u-type-error;
margin-top: 5px;
}
.demo-shop {
font-size: 22rpx;
color: $u-tips-color;
margin-top: 5px;
}
</style>
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
inputVal: 1, // 输入框中的值,不能直接使用props中的value,因为应该改变props的状态 inputVal: 1, // 输入框中的值,不能直接使用props中的value,因为应该改变props的状态
timer: null, // 用作长按的定时器 timer: null, // 用作长按的定时器
changeFromInner: false, // 值发生变化,是来自内部还是外部 changeFromInner: false, // 值发生变化,是来自内部还是外部
timer: null, // 内部定时器 innerChangeTimer: null, // 内部定时器
}; };
}, },
created() { created() {
...@@ -291,15 +291,15 @@ ...@@ -291,15 +291,15 @@
handleChange(value, type) { handleChange(value, type) {
if (this.disabled) return; if (this.disabled) return;
// 清除定时器,避免造成混乱 // 清除定时器,避免造成混乱
if(this.timer) { if(this.innerChangeTimer) {
clearTimeout(this.timer); clearTimeout(this.innerChangeTimer);
this.timer = null; this.innerChangeTimer = null;
} }
// 发出input事件,修改通过v-model绑定的值,达到双向绑定的效果 // 发出input事件,修改通过v-model绑定的值,达到双向绑定的效果
this.changeFromInner = true; this.changeFromInner = true;
// 一定时间内,清除changeFromInner标记,否则内部值改变后 // 一定时间内,清除changeFromInner标记,否则内部值改变后
// 外部通过程序修改value值,将会无效 // 外部通过程序修改value值,将会无效
setTimeout(() => { this.innerChangeTimer = setTimeout(() => {
this.changeFromInner = false; this.changeFromInner = false;
}, 150); }, 150);
this.$emit('input', Number(value)); this.$emit('input', Number(value));
......
...@@ -149,6 +149,9 @@ export default { ...@@ -149,6 +149,9 @@ export default {
}, },
elActiveIcon() { elActiveIcon() {
const len = this.icons.length const len = this.icons.length
// 此处规则类似于下方的elActiveColor参数,都是根据一定的规则,显示不同的图标
// 结果可能如此:icons参数传递了3个图标,当选中两个时,用第一个图标,4个时,用第二个图标
// 第三个时,用第三个图标作为激活的图标
if (len && len <= this.count) { if (len && len <= this.count) {
const step = Math.round(this.activeIndex / Math.round(this.count / len)) const step = Math.round(this.activeIndex / Math.round(this.count / len))
if (step < 1) return this.icons[0] if (step < 1) return this.icons[0]
...@@ -159,6 +162,8 @@ export default { ...@@ -159,6 +162,8 @@ export default {
}, },
elActiveColor() { elActiveColor() {
const len = this.colors.length const len = this.colors.length
// 如果有设置colors参数(此参数用于将图标分段,比如一共5颗星,colors传3个颜色值,那么根据一定的规则,2颗星可能为第一个颜色
// 4颗星为第二个颜色值,5颗星为第三个颜色值)
if (len && len <= this.count) { if (len && len <= this.count) {
const step = Math.round(this.activeIndex / Math.round(this.count / len)) const step = Math.round(this.activeIndex / Math.round(this.count / len))
if (step < 1) return this.colors[0] if (step < 1) return this.colors[0]
......
// 此版本发布于2020-09-21 // 此版本发布于2020-09-22
let version = '1.7.2'; let version = '1.7.3';
export default { export default {
v: version, v: version,
......
{ {
"name": "uview-ui", "name": "uview-ui",
"version": "1.7.2", "version": "1.7.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