This commit is contained in:
2025-07-28 14:36:38 +08:00
parent 1b9c2ba8e4
commit dbda3d702d
3 changed files with 9 additions and 10 deletions

View File

@@ -107,12 +107,11 @@ export default {
computed: {
...mapGetters(['agvObj']),
carData () {
try {
return JSON.parse(this.agvObj)
} catch (error) {
console.error('解析 JSON 时出错:', error)
return {}
let res = ''
if (this.agvObj !== '') {
res = JSON.parse(this.agvObj)
}
return res
}
},
mixins: [canvasZoomDrag],
@@ -124,7 +123,7 @@ export default {
this.carPositionWatcher = this.$watch(
() => this.carData,
(newVal) => {
if (newVal && newVal.x !== undefined && newVal.y !== undefined) {
if (newVal !== '') {
this.redrawCanvas()
}
},