Skip to content

Commit

Permalink
优化 logReversed
Browse files Browse the repository at this point in the history
  • Loading branch information
FairyEver committed Feb 6, 2019
1 parent 82c254a commit df8cf4c
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<el-table
:data="logReverse"
:data="logReversed"
border
stripe
style="width: 100%"
Expand Down Expand Up @@ -121,7 +121,7 @@

<script>
import { mapState } from 'vuex'
import { get } from 'lodash'
import { get, cloneDeep } from 'lodash'
import ExpandItem from './components/ExpandItem'
export default {
name: 'd2-error-log-list',
Expand All @@ -132,14 +132,8 @@ export default {
...mapState('d2admin', {
logList: state => state.log.list
}),
logReverse () {
// 直接 reverse 的话有点问题
const res = []
const loglength = this.logList.length
this.logList.forEach((log, index) => {
res.push(this.logList[loglength - 1 - index])
})
return res
logReversed () {
return cloneDeep(this.logList).reverse()
}
},
methods: {
Expand Down

0 comments on commit df8cf4c

Please sign in to comment.