+
@@ -39,12 +37,13 @@ export default {
mounted () {
const sizeList = ['xs', 'sm', 'md', 'lg'];
const classList = [];
- sizeList.forEach(size => {
- if (this[size] && this[size] <= 12) {
- classList.push(`layui-col-${size + this[size]}`);
- if (this.offset) {
- classList.push(`layui-col-${size + '-offset' + this.offset}`);
- }
+ sizeList.forEach(type => {
+ const val = this[type];
+ if (val && val <= 12) {
+ classList.push(`layui-col-${type}${val}`);
+ }
+ if (this.offset) {
+ classList.push(`layui-col-${type}-offset${this.offset}`);
}
});
this.classList = classList;
diff --git a/src/components/date-picker/README.md b/src/components/date-picker/README.md
index 4cd4876..5168783 100644
--- a/src/components/date-picker/README.md
+++ b/src/components/date-picker/README.md
@@ -8,8 +8,8 @@
- [x] 公历节日
- [x] 自定义重要日子
- [x] 限制可选日期
-- [ ] 多种款色任你挑选
-- [ ] 多种事件供你使用
+- [x] 多种款色任你挑选
+- [x] 多种事件供你使用
- [ ] 时间选择器
- [ ] 自定义时间格式
- [ ] 限制可选时间
diff --git a/src/components/date-picker/src/date-picker.vue b/src/components/date-picker/src/date-picker.vue
index 221c9f1..1887209 100644
--- a/src/components/date-picker/src/date-picker.vue
+++ b/src/components/date-picker/src/date-picker.vue
@@ -1,5 +1,8 @@
-
+
+
-
-
diff --git a/src/components/form/src/form-item.vue b/src/components/form/src/form-item.vue
index 7bd10af..05ffe63 100644
--- a/src/components/form/src/form-item.vue
+++ b/src/components/form/src/form-item.vue
@@ -31,9 +31,14 @@
diff --git a/src/components/input/src/input.vue b/src/components/input/src/input.vue
index 1302485..3963c9e 100644
--- a/src/components/input/src/input.vue
+++ b/src/components/input/src/input.vue
@@ -10,7 +10,10 @@
:class="{
'layui-radio-disbaled layui-disabled': disabled
}"
- @input="handleChange"
+ @input="handleInput"
+ @change="handleChange"
+ @blur="handleBlur"
+ @focus="handleFocus"
>
@@ -43,13 +46,26 @@ export default {
},
number: Boolean
},
+ inject: ['formItem'],
methods: {
- handleChange: function () {
+ emit (event, e) {
if (!this.disabled) {
- const value = event.target.value;
-
- this.$emit('input', this.number ? parseInt(value) || 0 : value);
+ const value = e.target.value;
+ this.$emit(event, this.number ? parseInt(value) || 0 : value);
+ this.formItem && this.formItem.validate(event);
}
+ },
+ handleChange (e) {
+ this.emit('change', e);
+ },
+ handleInput (e) {
+ this.emit('input', e);
+ },
+ handleBlur (e) {
+ this.emit('blur', e);
+ },
+ handleFocus (e) {
+ this.emit('focus', e);
}
}
};
diff --git a/src/components/radio/src/radio.vue b/src/components/radio/src/radio.vue
index 643a656..70fdb55 100644
--- a/src/components/radio/src/radio.vue
+++ b/src/components/radio/src/radio.vue
@@ -46,10 +46,13 @@ export default {
default: ''
}
},
+ inject: ['formItem'],
methods: {
- handleClick: function () {
+ handleClick () {
if (!this.disabled) {
+ this.$emit('change', this.label);
this.$emit('input', this.label);
+ this.formItem && this.formItem.validate('change');
}
}
}
diff --git a/src/components/rate/src/rate.vue b/src/components/rate/src/rate.vue
index 80b1a9f..a307f99 100644
--- a/src/components/rate/src/rate.vue
+++ b/src/components/rate/src/rate.vue
@@ -89,6 +89,7 @@ export default {
rate: 0
};
},
+ inject: ['formItem'],
watch: {
value () {
this.rate = this.value;
@@ -133,6 +134,7 @@ export default {
}
this.$emit('input', this.rate);
this.$emit('change', this.rate);
+ this.formItem && this.formItem.validate('change');
}
}
};
diff --git a/src/components/row/src/row.vue b/src/components/row/src/row.vue
index 1a36149..bc6bf85 100644
--- a/src/components/row/src/row.vue
+++ b/src/components/row/src/row.vue
@@ -1,10 +1,5 @@
-
+
diff --git a/src/components/select/src/select.vue b/src/components/select/src/select.vue
index 15533e5..a78497e 100644
--- a/src/components/select/src/select.vue
+++ b/src/components/select/src/select.vue
@@ -1,12 +1,18 @@
-