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
+2 -1
View File
@@ -2,6 +2,7 @@
* Create a basic component with common options
*/
import '../../locale';
import { isFunction } from '..';
import { camelize } from '../format/string';
import { SlotsMixin } from '../../mixins/slots';
import Vue, {
@@ -68,7 +69,7 @@ export function createComponent(name: string) {
return function<Props = DefaultProps, Events = {}, Slots = {}>(
sfc: VantComponentOptions | FunctionComponent
): TsxComponent<Props, Events, Slots> {
if (typeof sfc === 'function') {
if (isFunction(sfc)) {
sfc = transformFunctionComponent(sfc);
}
+2 -2
View File
@@ -1,4 +1,4 @@
import { get } from '..';
import { get, isFunction } from '..';
import { camelize } from '../format/string';
import locale from '../../locale';
@@ -9,7 +9,7 @@ export function createI18N(name: string) {
const messages = locale.messages();
const message = get(messages, prefix + path) || get(messages, path);
return typeof message === 'function' ? message(...args) : message;
return isFunction(message) ? message(...args) : message;
};
}