当前位置:   article > 正文

ElementUI之row-style

elementui row-style

行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。

Function({row, rowIndex})/Object

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <title>AdminLTE 2 | Morris.js Charts</title>
  7. <!-- Tell the browser to be responsive to screen width -->
  8. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  9. <link rel="stylesheet" href="../plugins/elementUI/elementUI.css">
  10. <style>
  11. .green{color:green;}
  12. </style>
  13. </head>
  14. <body class="">
  15. <div id="demo">
  16. <el-table :data="tableData" style="width: 100%" :row-style="rowStyle">
  17. <el-table-column prop="date" label="Date" width="180">
  18. </el-table-column>
  19. <el-table-column prop="name" label="Name" width="180">
  20. </el-table-column>
  21. <el-table-column prop="address" label="Address">
  22. </el-table-column>
  23. </el-table>
  24. </div>
  25. <script src="../js/vue.js"></script>
  26. <script src="../plugins/elementUI/elementUI.js"></script>
  27. <script>
  28. var demo = new Vue({
  29. el: '#demo',
  30. data: {
  31. tableData: [{
  32. date: '2016-05-03',
  33. name: 'Tom',
  34. address: 'No. 189, Grove St, Los Angeles'
  35. }, {
  36. date: '2016-05-02',
  37. name: 'Tom',
  38. address: 'No. 189, Grove St, Los Angeles'
  39. }, {
  40. date: '2016-05-03',
  41. name: 'Tom',
  42. address: 'No. 189, Grove St, Los Angeles'
  43. }, {
  44. date: '2016-05-01',
  45. name: 'Tom',
  46. address: 'No. 189, Grove St, Los Angeles'
  47. }]
  48. },
  49. methods: {
  50. rowStyle({ row, rowIndex}) {
  51. if (rowIndex === 0) {
  52. return 'color:green'
  53. } else {
  54. return ''
  55. }
  56. }
  57. }
  58. })
  59. </script>
  60. </body>
  61. </html>

 

转载于:https://my.oschina.net/u/2612473/blog/1607028

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/159030?site
推荐阅读
相关标签
  

闽ICP备14008679号