chore: add isFunction utils and improve isObject

This commit is contained in:
陈嘉涵
2020-01-19 20:13:50 +08:00
parent 3a4107ef49
commit 4b54ec6a18
11 changed files with 32 additions and 31 deletions
+6 -5
View File
@@ -1,5 +1,5 @@
import { deepClone } from '../utils/deep-clone';
import { createNamespace, isObj } from '../utils';
import { createNamespace, isObject } from '../utils';
import { range } from '../utils/format/number';
import { preventDefault } from '../utils/dom/event';
import { TouchMixin } from '../mixins/touch';
@@ -23,7 +23,7 @@ function getElementTranslateY(element) {
}
function isOptionDisabled(option) {
return isObj(option) && option.disabled;
return isObject(option) && option.disabled;
}
export default createComponent({
@@ -176,9 +176,10 @@ export default createComponent({
},
getOptionText(option) {
return isObj(option) && this.valueKey in option
? option[this.valueKey]
: option;
if (isObject(option) && this.valueKey in option) {
return option[this.valueKey];
}
return option;
},
setIndex(index, userAction) {