Browse Source

cancel inline-style for table <td> white-space

Leopoldthecoder 9 years ago
parent
commit
8de485ad82
2 changed files with 7 additions and 5 deletions
  1. 2 4
      examples/docs/message-box.md
  2. 5 1
      packages/table/src/table-body.js

+ 2 - 4
examples/docs/message-box.md

@@ -2,9 +2,7 @@
   export default {
     methods: {
       open() {
-        this.$alert('操作失败, 请稍后重试', '提示', {
-          type: 'error'
-        });
+        this.$alert('这是一段内容', '标题名称');
       },
 
       open2() {
@@ -74,7 +72,7 @@
   export default {
     methods: {
       open() {
-        this.$alert('操作失败, 请稍后重试', '提示');
+        this.$alert('这是一段内容', '标题名称');
       }
     }
   }

+ 5 - 1
packages/table/src/table-body.js

@@ -51,7 +51,7 @@ export default {
                 {
                   this._l(this.columns, (column) =>
                     <td
-                      style={{ 'white-space': column.showTooltipWhenOverflow ? 'nowrap' : 'normal' }}
+                      style={ this.getColumnWhiteSpaceStyle(column) }
                       class={ column.id }
                       on-mouseenter={ ($event) => this.handleCellMouseEnter($event, row) }
                       on-mouseleave={ this.handleCellMouseLeave }>
@@ -84,6 +84,10 @@ export default {
   },
 
   methods: {
+    getColumnWhiteSpaceStyle(column) {
+      return column.showTooltipWhenOverflow ? { 'white-space': 'nowrap' } : {};
+    },
+
     checkProperty(row) {
       if (this.criteria && this.criteria.length > 0) {
         for (let i = 0, len = this.criteria.length; i < len; i++) {