Skip to content

Commit db1b92a

Browse files
author
SpaceCowboy326
committed
couple things
1 parent 1ee242a commit db1b92a

File tree

5 files changed

+41
-18
lines changed

5 files changed

+41
-18
lines changed

package-lock.json

+8-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/MapData.vue

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div class="open-data--map-data">
3+
<div>{{ geo_json_data || "Data goes here" }}</div><button @click="retrieveGeoJsonData">Get Data</button
4+
</template>
5+
6+
<script>
7+
export default {
8+
methods: {
9+
retrieveGeoJsonData() {
10+
store.dispatch('retrieveGeoJsonData').then(() => {
11+
console.log("Done retrieving data");
12+
});
13+
}
14+
},
15+
computed: {
16+
geo_json_data() { return store.state.geo_json_data }
17+
}
18+
});
19+
</script>

src/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Vue from 'vue'
22
import App from './App.vue'
33
import router from './router'
4-
import store from './store'
4+
import {store} from './store'
55

66
Vue.config.productionTip = false
77

src/store.js

+4-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ const store = new Vuex.Store({
1717
async retrieveGeoJsonData(context) {
1818
let response, data;
1919
try {
20-
response = await Vue.http.get('/public/geojson_data.json');
20+
//response = await Vue.http.get('/public/geojson_data.json');
21+
console.log("Here we would get the data");
22+
response = {body:"meh"};
2123
} catch (ex) {
2224
console.err("Failed to retrieve GeoJson Data", ex);
2325
return;
@@ -31,16 +33,4 @@ const store = new Vuex.Store({
3133
}
3234
});
3335

34-
Vue.component('MapDataComponent', {
35-
template: '<div>{{ geo_json_data || "Data goes here" }}</div><button @click="retrieveGeoJsonData">Get Data</button',
36-
methods: {
37-
retrieveGeoJsonData() {
38-
this.$store.dispatch('retrieveGeoJsonData').then(() => {
39-
console.log("Done retrieving data");
40-
});
41-
}
42-
},
43-
computed: {
44-
geo_json_data() { return this.$store.state.geo_json_data }
45-
}
46-
});
36+
export {store};

src/views/About.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<template>
22
<div class="about">
33
<h1>This is an about page</h1>
4+
<MapData></MapData>
45
</div>
56
</template>
67

78

89
<script>
910
// @ is an alias to /src
10-
import MapData from '@/components/HelloWorld.vue'
11+
import MapData from '@/components/MapData.vue'
12+
13+
export default {
14+
name: 'about',
15+
components: {
16+
MapData
17+
}
18+
}
1119
1220
</script>

0 commit comments

Comments
 (0)