TransactionTable.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <el-table :data="list" style="width: 100%;padding-top: 15px;">
  3. <el-table-column label="Order_No" min-width="200">
  4. <template slot-scope="scope">
  5. {{ scope.row.order_no | orderNoFilter }}
  6. </template>
  7. </el-table-column>
  8. <el-table-column label="Price" width="195" align="center">
  9. <template slot-scope="scope">
  10. ¥{{ scope.row.price | toThousandFilter }}
  11. </template>
  12. </el-table-column>
  13. <el-table-column label="Status" width="100" align="center">
  14. <template slot-scope="{row}">
  15. <el-tag :type="row.status | statusFilter">
  16. {{ row.status }}
  17. </el-tag>
  18. </template>
  19. </el-table-column>
  20. </el-table>
  21. </template>
  22. <script>
  23. export default {
  24. filters: {
  25. statusFilter(status) {
  26. const statusMap = {
  27. success: 'success',
  28. pending: 'danger'
  29. }
  30. return statusMap[status]
  31. },
  32. orderNoFilter(str) {
  33. return str.substring(0, 30)
  34. }
  35. },
  36. data() {
  37. return {
  38. list: null
  39. }
  40. },
  41. created() {
  42. this.fetchData()
  43. },
  44. methods: {
  45. fetchData() {
  46. this.list = [{"order_no":"1","price":"12","status":"正常"},{"order_no":"2","price":"12","status":"正常"},{"order_no":"3","price":"12","status":"正常"}]
  47. }
  48. }
  49. }
  50. </script>