|
@@ -310,4 +310,21 @@ export default class App {
|
|
PubSub.publish('body.data.update', cards);
|
|
PubSub.publish('body.data.update', cards);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** * 加载地图文件 * *
|
|
|
|
+ * @param {String} url - 地图文件路径 *
|
|
|
|
+ */
|
|
|
|
+ loadMap(url) {
|
|
|
|
+ fetch(url)
|
|
|
|
+ .then(res => res.text())
|
|
|
|
+ .then(data => {
|
|
|
|
+ // 处理获取的数据
|
|
|
|
+ let json = JSON.parse(data);
|
|
|
|
+ PubSub.publish("body.draw.loaded", json);
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ // 处理错误
|
|
|
|
+ console.error('There was a problem with the fetch operation:', error);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|