# 添加count的类型判断
This commit is contained in:
parent
be79586a4d
commit
08ca34945d
|
@ -62,12 +62,12 @@ import { fetchDeviceList, fetchDeviceLogsHistory } from '@/api/counter'
|
|||
import Screen from './components/screen'
|
||||
import Chart from './components/chart'
|
||||
|
||||
const defaultLastItem = {
|
||||
mosq_count: '0',
|
||||
status: '0',
|
||||
signal: '0',
|
||||
energy: '0'
|
||||
}
|
||||
// const defaultLastItem = {
|
||||
// count: '0',
|
||||
// status: '0',
|
||||
// signal: '0',
|
||||
// energy: '0'
|
||||
// }
|
||||
export default {
|
||||
name: 'deviceDetail',
|
||||
components: {
|
||||
|
@ -117,8 +117,9 @@ export default {
|
|||
fetchDeviceList(params).then(response => {
|
||||
this.deviceList = response.data.results
|
||||
this.lastItem = this.deviceList[0]
|
||||
if (this.lastItem === undefined) {
|
||||
this.lastItem = defaultLastItem
|
||||
console.log(typeof (this.lastItem.count))
|
||||
if (typeof (this.lastItem.count) === 'number') {
|
||||
this.lastItem.count = this.lastItem.count.toString()
|
||||
}
|
||||
this.flag = true
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue