# 添加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 Screen from './components/screen'
|
||||||
import Chart from './components/chart'
|
import Chart from './components/chart'
|
||||||
|
|
||||||
const defaultLastItem = {
|
// const defaultLastItem = {
|
||||||
mosq_count: '0',
|
// count: '0',
|
||||||
status: '0',
|
// status: '0',
|
||||||
signal: '0',
|
// signal: '0',
|
||||||
energy: '0'
|
// energy: '0'
|
||||||
}
|
// }
|
||||||
export default {
|
export default {
|
||||||
name: 'deviceDetail',
|
name: 'deviceDetail',
|
||||||
components: {
|
components: {
|
||||||
|
@ -117,8 +117,9 @@ export default {
|
||||||
fetchDeviceList(params).then(response => {
|
fetchDeviceList(params).then(response => {
|
||||||
this.deviceList = response.data.results
|
this.deviceList = response.data.results
|
||||||
this.lastItem = this.deviceList[0]
|
this.lastItem = this.deviceList[0]
|
||||||
if (this.lastItem === undefined) {
|
console.log(typeof (this.lastItem.count))
|
||||||
this.lastItem = defaultLastItem
|
if (typeof (this.lastItem.count) === 'number') {
|
||||||
|
this.lastItem.count = this.lastItem.count.toString()
|
||||||
}
|
}
|
||||||
this.flag = true
|
this.flag = true
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue