[Improvement] optimize utils (#661)
This commit is contained in:
@@ -8,10 +8,10 @@ import install from './install';
|
||||
import Loading from '../loading';
|
||||
|
||||
export default function(sfc) {
|
||||
sfc.mixins = sfc.mixins || [];
|
||||
sfc.components = sfc.components || {};
|
||||
sfc.install = sfc.install || install;
|
||||
sfc.mixins = sfc.mixins || [];
|
||||
sfc.mixins.push(i18n);
|
||||
sfc.components = sfc.components || {};
|
||||
sfc.components.icon = Icon;
|
||||
sfc.components.loading = Loading;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import { isDef } from './';
|
||||
import { isDef, isObj } from './';
|
||||
|
||||
const { hasOwnProperty } = Object.prototype;
|
||||
|
||||
function isObj(x) {
|
||||
const type = typeof x;
|
||||
return x !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
function assignKey(to, from, key) {
|
||||
const val = from[key];
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@ function isDef(value) {
|
||||
return value !== undefined && value !== null;
|
||||
}
|
||||
|
||||
function isObj(x) {
|
||||
const type = typeof x;
|
||||
return x !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
function get(object, path) {
|
||||
const keys = path.split('.');
|
||||
let result = object;
|
||||
@@ -30,6 +35,7 @@ function isAndroid() {
|
||||
|
||||
export {
|
||||
get,
|
||||
isObj,
|
||||
isDef,
|
||||
create,
|
||||
isServer,
|
||||
|
||||
Reference in New Issue
Block a user