chore: classNames es

pull/2926/head
Amour1688 2020-09-16 12:45:04 +08:00
parent 87aa5ecbd8
commit 7cec8614b0
2 changed files with 24 additions and 22 deletions

View File

@ -1,9 +1,27 @@
import { isArray, isString, isObject } from './util';
function classNames() {
let classes = [];
for (let i = 0; i < arguments.length; i++) {
const value = arguments[i];
if (!value) continue;
export type ClassArray = ClassValue[];
export interface ClassDictionary {
[id: string]: any;
}
export type ClassValue =
| string
| number
| ClassDictionary
| ClassArray
| undefined
| null
| boolean;
function classNames(...args: ClassValue[]): string {
const classes = [];
for (let i = 0; i < args.length; i++) {
const value = args[i];
if (!value) {
continue;
}
if (isString(value)) {
classes.push(value);
} else if (isArray(value)) {

View File

@ -1,21 +1,5 @@
<<<<<<< HEAD:components/_util/props-util.ts
import isPlainObject from 'lodash/isPlainObject';
import classNames from 'classnames';
import {
isVNode,
Fragment,
Comment,
Text,
h,
VNode,
ComponentPublicInstance,
PropOptions,
} from 'vue';
=======
import { isVNode, Fragment, Comment, Text, h, VNode, ComponentPublicInstance } from 'vue';
import isPlainObject from 'lodash-es/isPlainObject';
import classNames from './classNames';
import { isVNode, Fragment, Comment, Text, h } from 'vue';
>>>>>>> @{-1}:components/_util/props-util.js
import { camelize, hyphenate, isOn, resolvePropValue } from './util';
import isValid from './isValid';
// function getType(fn) {