Skip to content

Commit 2a77b32

Browse files
author
二一
authored
feat:发布新版本0.6.7
2 parents 1139ff8 + 665f1da commit 2a77b32

File tree

73 files changed

+1211
-949
lines changed

Some content is hidden

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

73 files changed

+1211
-949
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ assignees: ''
77

88
---
99

10-
**重现步骤(可选):**
10+
**LinUI版本(必填):**
1111

12-
**期望的结果是什么?**
12+
**设备(必填):**
13+
14+
**基础库版本(必填):**
15+
16+
**UI问题,请附上截图**
17+
18+
**重现步骤,必要时请提供代码片段链接**
1319

14-
**实际的结果是什么?**

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<p align="center">
33
<!-- <a href="http://doc.mini.7yue.pro/"> -->
44
<img
5-
class="QR-img" src="http://imglf3.nosdn0.126.net/img/YUdIR2E3ME5weEZWVFhTU3I2YnRTVnB6VHZsbHR0SzJtMHNCK28rUE41QzljaFBmdmc2ZUFBPT0.jpg?imageView&thumbnail=500x0&quality=96&stripmeta=0&type=jpg">
5+
class="QR-img" src="https://raw.githubusercontent.com/zhc525349965/fisher_book/master/app/image/lin-ui小程序.jpg">
66
<!-- </a> -->
77
</p>
88

@@ -34,15 +34,15 @@
3434
Lin UI 是基于 **微信小程序原生语法** 实现的组件库。遵循简洁,易用的设计规范。
3535

3636
## 讨论交流
37-
QQ群号:699501172 <br/>
37+
QQ群号:643205479 <br/>
3838

39-
<img class="QR-img" style="height: 100px; width:100px" src="http://imglf4.nosdn0.126.net/img/YUdIR2E3ME5weEdlNThuRmI4TFh3YVczZzB1N3BrbithelM1OFZMb09SSDNuQSs5V0RhM2lBPT0.jpg?imageView&thumbnail=250x0&quality=96&stripmeta=0&type=jpg">
39+
<img class="QR-img" style="height: 100px; width:100px" src="https://raw.githubusercontent.com/zhc525349965/fisher_book/master/app/image/qq群新.png">
4040

4141

4242
## 微信公众号
4343
微信搜索:林间有风 <br/>
4444

45-
<img class="QR-img" style="height: 100px; width:100px" src="http://imglf6.nosdn0.126.net/img/YUdIR2E3ME5weEdlNThuRmI4TFh3UWhiNmladWVoaTlXUXpicEFPa1F6czFNYkdmcWRIbGRRPT0.jpg?imageView&thumbnail=500x0&quality=96&stripmeta=0&type=jpg">
45+
<img class="QR-img" style="height: 100px; width:100px" src="https://raw.githubusercontent.com/zhc525349965/fisher_book/master/app/image/公众号.jpg">
4646

4747

4848
## 快速上手
File renamed without changes.

dist/checkbox-group/index.js

Lines changed: 69 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,98 @@
1-
import rules from '../behaviors/rules';
2-
31
Component({
4-
behaviors: ['wx://form-field', rules],
2+
behaviors: ['wx://form-field'],
53
externalClasses: ['l-class', 'l-error-text', 'l-error-text-class'],
64
relations: {
75
'../checkbox/index': {
86
type: 'child',
9-
// linked() {
10-
// this.onChangeHandle();
11-
// },
12-
// linkChanged() {
13-
// this.onChangeHandle();
14-
// },
15-
// unlinked() {
16-
// this.onChangeHandle();
17-
// }
7+
linked(target) {
8+
this.init(target);
9+
},
10+
linkChanged() {
11+
},
12+
unlinked() {
13+
// this.init(target);
14+
}
1815
}
1916
},
2017
properties: {
21-
current: {
22-
type: Array,
23-
value: [],
24-
observer: 'onChangeHandle'
25-
},
18+
// 选项的排列方式 一行显示 or 多行显示
2619
placement: {
2720
type: String,
2821
value: 'column', //column row
2922
},
23+
// 最多选中值
24+
maxSelected: {
25+
type: [Number,null],
26+
value: null
27+
},
28+
minSelected: {
29+
type: [Number,null],
30+
value: null
31+
}
3032
},
3133
data: {
32-
value: [],
33-
list: [],
34-
length: null
3534
},
3635
attached() {
37-
this.initRules();
38-
},
39-
ready() {
40-
const len = this.items().length;
41-
this.data.length = len;
42-
this.setData({
43-
length: len
44-
});
45-
this.onChangeHandle();
46-
36+
let { minSelected, maxSelected} = this.properties;
37+
this.checkMax(minSelected, maxSelected);
4738
},
4839
methods: {
49-
items() {
50-
let items = this.getRelationNodes('../checkbox/index');
51-
return items;
40+
41+
init(target) {
42+
if(this._keys === undefined) this._keys = {};
43+
if(this._selected === undefined) this._selected = {};
44+
this.checkDefaultItem(target);
45+
this.checkedKeyRepeat(target);
5246
},
53-
// checkbox change
54-
onChangeHandle(val = this.data.current) {
55-
let items = this.getRelationNodes('../checkbox/index');
56-
const len = items.length;
57-
if (len === this.data.length) {
58-
items.forEach(item => {
59-
let type = val.indexOf(item.data.value) !== -1;
60-
item.onChangeHandle(type, 'init');
61-
});
47+
48+
checkedKeyRepeat(target) {
49+
let { key } = target.properties;
50+
if(this._keys[key]) {
51+
throw new Error(`keys有重复元素, chekbox的key属性不能重复:${key}`);
52+
} else {
53+
this._keys[key] = true;
6254
}
6355
},
64-
currentChange(val) {
6556

66-
// const index = this.data.current.indexOf(val.value)
67-
this.data.list.push(val);
68-
this.setData({
69-
value: this.data.list
70-
});
57+
checkDefaultItem(target) {
58+
const { key, checked } = target.properties;
59+
if(checked) {
60+
this._selected[key] = checked;
61+
}
7162
},
7263

73-
onEmitEventHandle(current) {
64+
checkMax(min, max) {
65+
if(min !== null && min < 0) {
66+
throw new Error('最小选择个数必须大于等于0');
67+
}
68+
if(max !== null && max < 0) {
69+
throw new Error('最多选择个数必须大于0');
70+
}
71+
if(max !== null && min !== null && min >= max) {
72+
throw new Error('最多选择个数必须大于最小选择个数');
73+
}
74+
},
7475

75-
const index = this.data.current.indexOf(current.value);
76-
index === -1 ? this.data.current.push(current.value) : this.data.current.splice(index, 1);
77-
index === -1 ? this.data.list.push(current) : this.data.list.splice(index, 1);
78-
this.setData({
79-
current: this.data.current
80-
}, () => {
81-
this.validatorData({
82-
value: this.data.value
83-
});
84-
});
76+
onEmitEventHandle(currentItem) {
77+
currentItem.checked ? this.addSelect(currentItem.key):this.removeSelect(currentItem.key);
8578

86-
const all = JSON.parse(JSON.stringify(this.data.list));
87-
for (let i = 0; i < all.length; i++) {
88-
delete all[i].all;
89-
}
90-
current.all = all;
91-
this.setData({
92-
value: all
79+
this.triggerEvent('linchange', currentItem, {
80+
bubbles: true,
81+
composed: true
9382
});
94-
this.triggerEvent('linchange', current);
83+
},
84+
onEmitOverflowHandle(data){
85+
this.triggerEvent('linout', data, {
86+
bubbles: true,
87+
composed: true
88+
});
89+
},
90+
removeSelect(key) {
91+
delete this._selected[key];
92+
},
93+
addSelect(key) {
94+
this._selected[key] = key;
9595
}
96+
9697
}
97-
});
98+
});

dist/checkbox-group/index.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"component": true,
33
"usingComponents": {
4-
"l-error-tip":"../error-tip/index"
4+
"l-error-tip":"../error-tip/index",
5+
"l-checkbox": "../checkbox/index"
56
}
6-
}
7+
}

dist/checkbox-group/index.wxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<view class="l-class checkbox-group-{{placement}}">
2-
<slot></slot>
1+
<view class="l-class checkbox-group checkbox-group-{{placement}} ">
2+
<slot></slot>
33
</view>
44
<l-error-tip l-error-text-class="l-error-text l-error-text-class" errorText="{{errorText}}" wx:if="{{errorText}}"/>

dist/checkbox-group/index.wxss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.checkbox-group-row{display:flex;flex-direction:row}.checkbox-group-column{display:flex;flex-direction:column}
1+
.checkbox-group{flex-wrap:wrap}.checkbox-group-row{display:flex;flex-direction:row}.checkbox-group-column{display:flex;flex-direction:column}

0 commit comments

Comments
 (0)