diff --git a/components/_util/props-util.js b/components/_util/props-util.js index b3912d022..996b6f8a6 100644 --- a/components/_util/props-util.js +++ b/components/_util/props-util.js @@ -180,14 +180,16 @@ export function getClass (ele) { } else if (ele.$vnode && ele.$vnode.data) { data = ele.$vnode.data } - const tempCls = data.class || data.staticClass + const tempCls = data.class || {} + const staticClass = data.staticClass let cls = {} + staticClass && staticClass.split(' ').forEach(c => { cls[c.trim()] = true }) if (typeof tempCls === 'string') { tempCls.split(' ').forEach(c => { cls[c.trim()] = true }) } else if (Array.isArray(tempCls)) { classNames(tempCls).split(' ').forEach(c => { cls[c.trim()] = true }) } else { - cls = tempCls + cls = { ...cls, ...tempCls } } return cls } diff --git a/components/table/__tests__/__snapshots__/Table.test.js.snap b/components/table/__tests__/__snapshots__/Table.test.js.snap index 4317c5562..d48f252c5 100644 --- a/components/table/__tests__/__snapshots__/Table.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.test.js.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Table renders JSX correctly 1`] = ` -
Name | Age | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
First Name | Last Name | |||||||||||||||||||||||||||||||||||||||||||||||||||
+
+ |
John |
- Brown |
- 32 |
- New York No. 1 Lake Park |
- |
- nice developer Action 一 John Delete |
+ Brown |
+ 32 |
+ New York No. 1 Lake Park |
+ |
+ nice developer Action 一 John Delete |
+ |
Jim |
- Green |
- 42 |
- London No. 1 Lake Park |
- |
- loser Action 一 Jim Delete |
+ Green |
+ 42 |
+ London No. 1 Lake Park |
+ |
+ loser Action 一 Jim Delete |
+ |
Joe |
- Black |
- 32 |
- Sidney No. 1 Lake Park |
- |
- cool teacher Action 一 Joe Delete |
+ Black |
+ 32 |
+ Sidney No. 1 Lake Park |
+ |
+ cool teacher Action 一 Joe Delete |
|