index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div v-if="errorLogs.length>0">
  3. <el-badge
  4. :is-dot="true"
  5. style="line-height: 25px;margin-top: -5px;"
  6. @click.native="dialogTableVisible=true"
  7. >
  8. <el-button style="padding: 8px 10px;" size="small" type="danger">
  9. <!-- <svg-icon icon-class="bug" /> -->
  10. </el-button>
  11. </el-badge>
  12. <el-dialog :visible.sync="dialogTableVisible" width="80%" append-to-body>
  13. <div slot="title">
  14. <span style="padding-right: 10px;">Error Log</span>
  15. <el-button size="mini" type="primary" icon="el-icon-delete" @click="clearAll">Clear All</el-button>
  16. </div>
  17. <el-table :data="errorLogs" border>
  18. <el-table-column label="Message">
  19. <template slot-scope="{row}">
  20. <div>
  21. <span class="message-title">Msg:</span>
  22. <el-tag type="danger">{{ row.err.message }}</el-tag>
  23. </div>
  24. <br />
  25. <div>
  26. <span class="message-title" style="padding-right: 10px;">Info:</span>
  27. <el-tag type="warning">{{ row.vm.$vnode.tag }} error in {{ row.info }}</el-tag>
  28. </div>
  29. <br />
  30. <div>
  31. <span class="message-title" style="padding-right: 16px;">Url:</span>
  32. <el-tag type="success">{{ row.url }}</el-tag>
  33. </div>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="Stack">
  37. <template slot-scope="scope">{{ scope.row.err.stack }}</template>
  38. </el-table-column>
  39. </el-table>
  40. </el-dialog>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. name: "ErrorLog",
  46. data() {
  47. return {
  48. dialogTableVisible: false
  49. };
  50. },
  51. computed: {
  52. errorLogs() {
  53. return this.$store.getters.errorLogs;
  54. }
  55. },
  56. methods: {
  57. clearAll() {
  58. this.dialogTableVisible = false;
  59. this.$store.dispatch("errorLog/clearErrorLog");
  60. }
  61. }
  62. };
  63. </script>
  64. <style scoped>
  65. .message-title {
  66. font-size: 16px;
  67. color: #333;
  68. font-weight: bold;
  69. padding-right: 8px;
  70. }
  71. </style>