Merge branch 'master' into feature/add_test

This commit is contained in:
jiangruowei
2017-03-17 17:45:37 +08:00
22 changed files with 206 additions and 49 deletions
+1 -6
View File
@@ -16,7 +16,6 @@ import ZanLoading from 'packages/loading';
* @param {boolean} [checked=false] - 开关状态
* @param {boolean} [disabled=false] - 禁用
* @param {boolean} [loading=false] - loading状态
* @param {callback} [onChange] - 开关状态改变回调函数。
*
* @example
* <zan-switch checked="true" disabled="false"></zan-switch>
@@ -38,10 +37,6 @@ export default {
loading: {
type: Boolean,
default: false
},
onChange: {
type: Function,
default: function() {}
}
},
computed: {
@@ -58,7 +53,7 @@ export default {
*/
toggleState: function() {
if (this.disabled || this.loading) return;
this.onChange(!this.checked);
this.$emit('change', !this.checked);
}
}
};
+23
View File
@@ -1,4 +1,5 @@
import Vue from 'vue';
import merge from 'src/utils/merge';
const ToastConstructor = Vue.extend(require('./toast.vue'));
let toastQueue = [];
@@ -50,4 +51,26 @@ var Toast = (options = {}) => {
return instance;
};
Toast.loading = (options) => {
return new Toast(merge({
type: 'loading'
}, options));
};
Toast.success = (options) => {
const message = typeof options === 'string' ? options : options.message;
return new Toast(merge({
type: 'success',
message: message
}, options));
};
Toast.fail = (options) => {
const message = typeof options === 'string' ? options : options.message;
return new Toast(merge({
type: 'fail',
message: message
}, options));
};
export default Toast;
+2 -2
View File
@@ -22,7 +22,7 @@
import zanLoading from 'packages/loading';
import zanIcon from 'packages/icon';
const TOAST_TYPES = ['text', 'loading', 'success', 'failure'];
const TOAST_TYPES = ['text', 'loading', 'success', 'fail'];
/**
* zan-toast
* @module components/toast
@@ -50,7 +50,7 @@ export default {
type: String,
default: '',
validate(value) {
if (this.type === 'success' || this.type === 'failure') {
if (this.type === 'success' || this.type === 'fail') {
return value.length <= 16;
}
}
+2
View File
@@ -66,12 +66,14 @@
padding: 1px;
border: 1px solid $c-gray-dark;
border-width: 1px 0;
border-radius: 0;
box-sizing: content-box;
color: $c-gray-darker;
font-size: 14px;
outline: 0;
vertical-align: middle;
text-align: center;
-webkit-appearance: none;
}
}
}
+2 -1
View File
@@ -19,7 +19,8 @@
}
@m text {
padding: 11px;
padding: 12px;
min-width: 200px;
}
@m default {