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
+
- - + + - - - + +
Name
Age
First Name
Last Name
JohnBrown32Brown32
+ JimGreen42Green42
diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index cc56e8ed7..9a4ffeb6f 100644 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -2896,31 +2896,31 @@ exports[`renders ./components/table/demo/template.md correctly 1`] = `
+ JohnBrown32New York No. 1 Lake Park
nice
developer
Action 一 John
Delete
Brown32New York No. 1 Lake Park
nice
developer
Action 一 John
Delete
+ JimGreen42London No. 1 Lake Park
loser
Action 一 Jim
Delete
Green42London No. 1 Lake Park
loser
Action 一 Jim
Delete
+ JoeBlack32Sidney No. 1 Lake Park
cool
teacher
Action 一 Joe
Delete
Black32Sidney No. 1 Lake Park
cool
teacher
Action 一 Joe
Delete