Skip to content

Commit 3f6d2fe

Browse files
author
guoxiao158
committed
Merge branch 'v2' of https://github.com/jdf2e/nutui into v2
2 parents 1685aa1 + 5c73581 commit 3f6d2fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1302
-571
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
## 2.2.2
2+
3+
`2020-03-31`
4+
5+
* :sparkles: feat(Video):新增数据展示-视频组件 @vickyYE
6+
* :sparkles: feat(TimeLine):新增时间轴组件 @yangxiaolu1993
7+
* :sparkles: feat(Signature):新增业务类型-签名组件 @irisSong
8+
* :sparkles: upd(TabSelect):新增确认按钮回调事件 @yi-ge
9+
* :sparkles: upd(TextBox):新增v-model属性 @yi-ge
10+
* :sparkles: upd(Stepper):新增超出最小、最大回调事件 @richard1015
11+
* :sparkles: upd(ActionSheet):优化内部代码,文档优化 @irisSong
12+
* :sparkles: upd(Flex):优化内部代码,文档优化 @szg2008
13+
* :sparkles: upd(Toast):优化内部代码,文档优化 @zy19940510
14+
* :sparkles: upd(Progress):优化内部代码,文档优化 @layman666
15+
* :sparkles: upd(SearchBar、TextInput):组件优化 @yangxiaolu1993
16+
* :bug: upd(Range):绑定的值无法更新到组件 #227 @undo03
17+
* :bug: upd(Countdown):修复异步计算属性无法更新组件 #228 @undo03
18+
* :bug: upd(LuckDraw):抽奖组件图片链接修复 @Ymm0008
19+
* :bug: upd(Picker)优化自定义数据联动demo @irisSong
20+
* :bug: upd(Popup):按需加载icon修复 @yangkaixuan
21+
* :bug: upd(TabSelect):组件tabList数据改变内容不刷新问题修复 @dushoujun
22+
* :bug: upd(TabBar):更新数据 重新渲染的功能 @zhenyulei
23+
124
## 2.2.1
225

326
`2020-03-09`

README-zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
* 全新的架构
1313
* 50+ 高质量组件
14-
* 30+ 京东移动端项目正在使用
14+
* 40+ 京东移动端项目正在使用
1515
* 参照京东APP 7.0 视觉规范
1616
* 支持按需加载
1717
* 详尽的文档和示例

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ English | [简体中文](./README-zh_CN.md)
1111

1212
* New structure
1313
* 50+ Reusable components
14-
* Used by 30+ JD mobile projects
14+
* Used by 40+ JD mobile projects
1515
* Refer to JD APP 7.0 visual specification
1616
* On-demand loading Support
1717
* Detailed documents and examples

docs/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ NutUI是一套京东风格的移动端Vue组件库,开发和服务于移动Web
1515
## 特性
1616

1717
* 50+ 高质量组件
18-
* 30+ 京东移动端项目正在使用
18+
* 40+ 京东移动端项目正在使用
1919
* 基于京东APP 7.0 视觉规范
2020
* 支持按需加载
2121
* 详尽的文档和示例

src/config.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,26 @@
553553
"sort": "6",
554554
"showDemo": true,
555555
"author": "irisSong"
556+
},
557+
{
558+
"version": "1.0.0",
559+
"name": "TimeLine",
560+
"chnName": "时间轴",
561+
"desc": "对一系列数据进行展示,垂直展示",
562+
"type": "component",
563+
"sort": "0",
564+
"showDemo": true,
565+
"author": "yangxiaolu"
566+
},
567+
{
568+
"version": "1.0.0",
569+
"name": "TimeLineItem",
570+
"chnName": "时间轴节点",
571+
"desc": "定义时间轴节点",
572+
"type": "component",
573+
"sort": "0",
574+
"showDemo": false,
575+
"author": "yangxiaolu"
556576
}
557577
]
558578
}

src/nutui.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ import Video from "./packages/video/index.js";
106106
import "./packages/video/video.scss";
107107
import Signature from "./packages/signature/index.js";
108108
import "./packages/signature/signature.scss";
109+
import TimeLine from "./packages/timeline/index.js";
110+
import "./packages/timeline/timeline.scss";
111+
import TimeLineItem from "./packages/timelineitem/index.js";
112+
import "./packages/timelineitem/timelineitem.scss";
109113

110114
const packages = {
111115
Cell,
@@ -159,7 +163,9 @@ const packages = {
159163
TabSelect: TabSelect,
160164
LuckDraw: LuckDraw,
161165
Video: Video,
162-
Signature: Signature
166+
Signature: Signature,
167+
TimeLine: TimeLine,
168+
TimeLineItem: TimeLineItem
163169
};
164170

165171
const components = {};

src/packages/avatar/avatar.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.text{
1818
display: inline-block;
1919
width:100%;
20+
height: 100%;
2021
text-align: center;
2122
overflow: hidden;
2223
}

src/packages/avatar/avatar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default {
4747
},
4848
methods: {
4949
activeAvatar(){
50-
this.$emit('activeAvatar');
50+
this.$emit('active-avatar');
5151
}
5252
}
5353
}

src/packages/avatar/demo.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
</div>
1616
<h4>修改背景色</h4>
1717
<div class="white-bg">
18-
<nut-avatar bgcolor="#f0250f"></nut-avatar>
18+
<nut-avatar bg-color="#f0250f"></nut-avatar>
1919
</div>
2020
<h4>可以修改头像的内容</h4>
2121
<div class="white-bg">
22-
<nut-avatar size="large" bgIcon>U</nut-avatar>
22+
<nut-avatar size="large" bg-icon>U</nut-avatar>
2323
</div>
2424
<h4>修改背景图片</h4>
2525
<div class="white-bg">
@@ -36,7 +36,7 @@
3636
</div>
3737
<h4>点击头像有触发事件</h4>
3838
<div class="white-bg">
39-
<nut-avatar @activeAvatar="activeAvatar"></nut-avatar>
39+
<nut-avatar @active-avatar="activeAvatar"></nut-avatar>
4040
</div>
4141
</div>
4242
</template>

src/packages/avatar/doc.md

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@
44

55
## 基本用法
66

7-
```html
8-
<nut-avatar></nut-avatar>
9-
```
10-
11-
## 设置背景色
12-
13-
```html
14-
<nut-avatar
15-
bgColor="#87d068"
16-
></nut-avatar>
17-
```
18-
19-
20-
## 设置大小
21-
227
内置 **smal** / **normal** / **large** 三种尺寸规格
238

249
```html
@@ -27,61 +12,60 @@
2712
<nut-avatar size="small"></nut-avatar>
2813
```
2914

30-
## 设置头像的形状类型
15+
## 修改形状类型
16+
3117
```html
32-
<nut-avatar
33-
shape="square"
34-
></nut-avatar>
18+
<nut-avatar size="large" shape="square"></nut-avatar>
19+
<nut-avatar size="normal" shape="square"></nut-avatar>
20+
<nut-avatar size="small" shape="square"></nut-avatar>
3521
```
3622

23+
## 修改背景色
24+
25+
```html
26+
<nut-avatar bg-color="#f0250f"></nut-avatar>
27+
```
3728

3829
## 设置头像的文本内容
30+
3931
```html
40-
<nut-avatar
41-
:size="30"
42-
bgIcon=""
43-
>U</nut-avatar>
32+
<nut-avatar size="large" bg-icon>U</nut-avatar>
4433
```
4534

46-
## 设置头像背景图片
35+
## 设置背景图片
4736
```html
48-
<nut-avatar
49-
bgIcon=""
50-
bgImage="http://img30.360buyimg.com/uba/jfs/t1/84318/29/2102/10483/5d0704c1Eb767fa74/fc456b03fdd6cbab.png"
51-
>
52-
</nut-avatar>
37+
<nut-avatar
38+
bg-icon
39+
bg-image="http://img30.360buyimg.com/uba/jfs/t1/84318/29/2102/10483/5d0704c1Eb767fa74/fc456b03fdd6cbab.png"
40+
></nut-avatar>
5341
```
5442

55-
## 设置头像Icon图标
43+
## 设置头像ICON图标
5644
```html
5745
<nut-avatar
58-
bgIcon="http://img10.360buyimg.com/uba/jfs/t1/69001/30/2126/550/5d06f947Effd02898/95f18e668670e598.png"
59-
>
60-
</nut-avatar>
46+
bg-icon="http://img10.360buyimg.com/uba/jfs/t1/69001/30/2126/550/5d06f947Effd02898/95f18e668670e598.png"
47+
></nut-avatar>
6148
```
6249

6350
## 点击头像有触发事件
6451
```html
65-
<nut-avatar
66-
@activeAvatar="activeAvatar"
67-
>
68-
</nut-avatar>
52+
<nut-avatar @active-avatar="activeAvatar"></nut-avatar>
6953
```
7054

7155

7256
## Prop
7357

7458
| 字段 | 说明 | 类型 | 默认值
7559
|----- | ----- | ----- | -----
76-
| bgColor | 设置头像背景色 | String | #eee
60+
| bg-color | 设置头像背景色 | String | #eee
7761
| size | 设置头像的大小,提供三种:large /normal/small | String | normal
78-
| shape | 设置头像的形状,默认是圆形,可以设置为square方形 | String | --
79-
| bgImage | 设置头像的背景图片 | String | --
80-
| bgIcon | 设置头像的icon图标 | String | --
62+
| shape | 设置头像的形状,默认是圆形,可以设置为square方形 | String | round
63+
| bg-image | 设置头像的背景图片 | String | --
64+
| bg-icon | 设置头像的icon图标 | String | --
8165

8266

8367
## Event
8468

8569
| 字段 | 说明 | 回调参数
8670
|----- | ----- | -----
87-
| activeAvatar | 点击头像触发事件 | --
71+
| active-avatar | 点击头像触发事件 | --

src/packages/backtop/backtop.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export default {
123123
this.isAnimation && this.duration > 0
124124
? this.scrollAnimation()
125125
: this.scroll();
126+
this.$emit("click");
126127
},
127128
scrollAnimation() {
128129
const self = this;
@@ -133,7 +134,7 @@ export default {
133134
var y = (t * -self.scrollTop) / self.duration + self.scrollTop;
134135
self.scroll(y);
135136
cid = self.requestAniFrame()(fn);
136-
if (t == self.duration) {
137+
if (t == self.duration || y == 0) {
137138
window.cancelAnimationFrame(cid);
138139
}
139140
});

src/packages/countdown/countdown.vue

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ const countdownTimer = {
119119
this.p += (this.getTimeStamp() - this._curr);
120120
this.$emit('on-restart', this.restTime);
121121
}
122+
},
123+
endTime() {
124+
this.initTimer();
122125
}
123126
},
124127
methods: {
@@ -127,29 +130,32 @@ const countdownTimer = {
127130
let t = timeStr;
128131
t = t > 0? +t: t.toString().replace(/\-/g, '/');
129132
return new Date(t).getTime();
133+
},
134+
initTimer() {
135+
const delay = 1000;
136+
const curr = Date.now();
137+
const start = this.getTimeStamp(this.startTime || curr);
138+
const end = this.getTimeStamp(this.endTime || curr);
139+
const diffTime = curr - start;
140+
141+
this.restTime = end - (start + diffTime);
142+
this.timer = setInterval(() => {
143+
if(!this.paused) {
144+
let restTime = end - (Date.now() - this.p + diffTime);
145+
this.restTime = restTime;
146+
if(restTime < delay) {
147+
this.restTime = 0;
148+
this.$emit('on-end');
149+
clearInterval(this.timer);
150+
}
151+
}else{
152+
// 暂停
153+
}
154+
}, delay);
130155
}
131156
},
132157
created() {
133-
const delay = 1000;
134-
const curr = Date.now();
135-
const start = this.getTimeStamp(this.startTime || curr);
136-
const end = this.getTimeStamp(this.endTime || curr);
137-
const diffTime = curr - start;
138-
139-
this.restTime = end - (start + diffTime);
140-
this.timer = setInterval(() => {
141-
if(!this.paused) {
142-
let restTime = end - (Date.now() - this.p + diffTime);
143-
this.restTime = restTime;
144-
if(restTime < delay) {
145-
this.restTime = 0;
146-
this.$emit('on-end');
147-
clearInterval(this.timer);
148-
}
149-
}else{
150-
// 暂停
151-
}
152-
}, delay);
158+
this.initTimer();
153159
}
154160
}
155161
countdownTimer.restTime = restTime;

src/packages/countdown/demo.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
<nut-countdown slot="title" showDays showPlainText :endTime="end" />
2525
</nut-cell>
2626
</div>
27+
<h4>异步更新结束时间</h4>
28+
<div>
29+
<nut-cell>
30+
<nut-countdown slot="title" showPlainText :endTime="asyncEnd" />
31+
</nut-cell>
32+
</div>
2733
<h4>控制开始和暂停的倒计时</h4>
2834
<div>
2935
<nut-cell>
@@ -50,6 +56,7 @@ export default {
5056
return {
5157
serverTime: Date.now() - 30 * 1000,
5258
end: Date.now() + 50 * 1000,
59+
asyncEnd: 0,
5360
paused: false
5461
};
5562
},
@@ -66,6 +73,11 @@ export default {
6673
onrestart(v) {
6774
console.log('restart: ', v);
6875
}
76+
},
77+
mounted() {
78+
setTimeout(() => {
79+
this.asyncEnd = Date.now() + 30 * 1000
80+
}, 3000)
6981
}
7082
};
7183
</script>

src/packages/countdown/doc.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
</nut-countdown>
4242
```
4343

44+
异步更新结束时间
45+
46+
```html
47+
<nut-countdown
48+
showDays
49+
showPlainText
50+
:endTime="asyncEnd"
51+
>
52+
</nut-countdown>
53+
```
54+
4455
控制开始和暂停的倒计时
4556

4657
```html
@@ -65,7 +76,7 @@
6576
## Event
6677

6778
| 字段 | 说明 | 回调参数
68-
| ----- | ----- | ----- | -----
79+
| ----- | ----- | -----
6980
| on-end | 倒计时结束时 | 剩余时间戳
7081
| on-paused | 暂停时 | 剩余时间戳
7182
| on-restart | 暂停时 | 剩余时间戳

src/packages/leftslip/__test__/leftslip.spec.js

100644100755
File mode changed.

0 commit comments

Comments
 (0)