FEMessage / el-data-table

🥘Base on element-ui, makes crud easily
https://femessage.github.io/el-data-table/
MIT License
486 stars 112 forks source link

fix: tableAttrs 无法修改 rowClassName 的问题 #284

Closed donaldshen closed 4 years ago

donaldshen commented 4 years ago

Why

fix #283

How

原有的 showRow 方法是用来展现一个 toggle 的动画的;现在的处理是合并该逻辑与用户通过 tableAttrs 传进来的逻辑

Test

https://deploy-preview-284--el-data-table.netlify.com/#/Demo/is-tree?q=size~999,page~1,

// is-tree.md
export default {
  data: function() {
    return {
      isTree: true,
      tableAttrs: {
        rowClassName({rowIndex}) {
          return rowIndex === 2 ? 'is-tree-red' : ''
        }
      },
    }
  },
  created() {
    // FYI: styleguide 里面用不了 style block
    document.querySelector('style').sheet.insertRule('.is-tree-red {color: red}')
  }
}

Before

image

After

image

netlify[bot] commented 4 years ago

Deploy preview for el-data-table ready!

Built with commit ded4825b803ae7c3812f434ea7b1dd16b88c6800

https://deploy-preview-284--el-data-table.netlify.com