Skip to content

Commit

Permalink
feat:发布新版本0.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
二一 committed Oct 16, 2019
2 parents 1139ff8 + 665f1da commit 2a77b32
Show file tree
Hide file tree
Showing 73 changed files with 1,211 additions and 949 deletions.
11 changes: 8 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ assignees: ''

---

**重现步骤(可选):**
**LinUI版本(必填):**

**期望的结果是什么?**
**设备(必填):**

**基础库版本(必填):**

**UI问题,请附上截图**

**重现步骤,必要时请提供代码片段链接**

**实际的结果是什么?**
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<p align="center">
<!-- <a href="http://doc.mini.7yue.pro/"> -->
<img
class="QR-img" src="http://imglf3.nosdn0.126.net/img/YUdIR2E3ME5weEZWVFhTU3I2YnRTVnB6VHZsbHR0SzJtMHNCK28rUE41QzljaFBmdmc2ZUFBPT0.jpg?imageView&thumbnail=500x0&quality=96&stripmeta=0&type=jpg">
class="QR-img" src="https://raw.githubusercontent.com/zhc525349965/fisher_book/master/app/image/lin-ui小程序.jpg">
<!-- </a> -->
</p>

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

## 讨论交流
QQ群号:699501172 <br/>
QQ群号:643205479 <br/>

<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">
<img class="QR-img" style="height: 100px; width:100px" src="https://raw.githubusercontent.com/zhc525349965/fisher_book/master/app/image/qq群新.png">


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

<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">
<img class="QR-img" style="height: 100px; width:100px" src="https://raw.githubusercontent.com/zhc525349965/fisher_book/master/app/image/公众号.jpg">


## 快速上手
Expand Down
File renamed without changes.
137 changes: 69 additions & 68 deletions dist/checkbox-group/index.js
Original file line number Diff line number Diff line change
@@ -1,97 +1,98 @@
import rules from '../behaviors/rules';

Component({
behaviors: ['wx://form-field', rules],
behaviors: ['wx://form-field'],
externalClasses: ['l-class', 'l-error-text', 'l-error-text-class'],
relations: {
'../checkbox/index': {
type: 'child',
// linked() {
// this.onChangeHandle();
// },
// linkChanged() {
// this.onChangeHandle();
// },
// unlinked() {
// this.onChangeHandle();
// }
linked(target) {
this.init(target);
},
linkChanged() {
},
unlinked() {
// this.init(target);
}
}
},
properties: {
current: {
type: Array,
value: [],
observer: 'onChangeHandle'
},
// 选项的排列方式 一行显示 or 多行显示
placement: {
type: String,
value: 'column', //column row
},
// 最多选中值
maxSelected: {
type: [Number,null],
value: null
},
minSelected: {
type: [Number,null],
value: null
}
},
data: {
value: [],
list: [],
length: null
},
attached() {
this.initRules();
},
ready() {
const len = this.items().length;
this.data.length = len;
this.setData({
length: len
});
this.onChangeHandle();

let { minSelected, maxSelected} = this.properties;
this.checkMax(minSelected, maxSelected);
},
methods: {
items() {
let items = this.getRelationNodes('../checkbox/index');
return items;

init(target) {
if(this._keys === undefined) this._keys = {};
if(this._selected === undefined) this._selected = {};
this.checkDefaultItem(target);
this.checkedKeyRepeat(target);
},
// checkbox change
onChangeHandle(val = this.data.current) {
let items = this.getRelationNodes('../checkbox/index');
const len = items.length;
if (len === this.data.length) {
items.forEach(item => {
let type = val.indexOf(item.data.value) !== -1;
item.onChangeHandle(type, 'init');
});

checkedKeyRepeat(target) {
let { key } = target.properties;
if(this._keys[key]) {
throw new Error(`keys有重复元素, chekbox的key属性不能重复:${key}`);
} else {
this._keys[key] = true;
}
},
currentChange(val) {

// const index = this.data.current.indexOf(val.value)
this.data.list.push(val);
this.setData({
value: this.data.list
});
checkDefaultItem(target) {
const { key, checked } = target.properties;
if(checked) {
this._selected[key] = checked;
}
},

onEmitEventHandle(current) {
checkMax(min, max) {
if(min !== null && min < 0) {
throw new Error('最小选择个数必须大于等于0');
}
if(max !== null && max < 0) {
throw new Error('最多选择个数必须大于0');
}
if(max !== null && min !== null && min >= max) {
throw new Error('最多选择个数必须大于最小选择个数');
}
},

const index = this.data.current.indexOf(current.value);
index === -1 ? this.data.current.push(current.value) : this.data.current.splice(index, 1);
index === -1 ? this.data.list.push(current) : this.data.list.splice(index, 1);
this.setData({
current: this.data.current
}, () => {
this.validatorData({
value: this.data.value
});
});
onEmitEventHandle(currentItem) {
currentItem.checked ? this.addSelect(currentItem.key):this.removeSelect(currentItem.key);

const all = JSON.parse(JSON.stringify(this.data.list));
for (let i = 0; i < all.length; i++) {
delete all[i].all;
}
current.all = all;
this.setData({
value: all
this.triggerEvent('linchange', currentItem, {
bubbles: true,
composed: true
});
this.triggerEvent('linchange', current);
},
onEmitOverflowHandle(data){
this.triggerEvent('linout', data, {
bubbles: true,
composed: true
});
},
removeSelect(key) {
delete this._selected[key];
},
addSelect(key) {
this._selected[key] = key;
}

}
});
});
5 changes: 3 additions & 2 deletions dist/checkbox-group/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"component": true,
"usingComponents": {
"l-error-tip":"../error-tip/index"
"l-error-tip":"../error-tip/index",
"l-checkbox": "../checkbox/index"
}
}
}
4 changes: 2 additions & 2 deletions dist/checkbox-group/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<view class="l-class checkbox-group-{{placement}}">
<slot></slot>
<view class="l-class checkbox-group checkbox-group-{{placement}} ">
<slot></slot>
</view>
<l-error-tip l-error-text-class="l-error-text l-error-text-class" errorText="{{errorText}}" wx:if="{{errorText}}"/>
2 changes: 1 addition & 1 deletion dist/checkbox-group/index.wxss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.checkbox-group-row{display:flex;flex-direction:row}.checkbox-group-column{display:flex;flex-direction:column}
.checkbox-group{flex-wrap:wrap}.checkbox-group-row{display:flex;flex-direction:row}.checkbox-group-column{display:flex;flex-direction:column}
Loading

0 comments on commit 2a77b32

Please sign in to comment.