OtherNodes.vue 838 Bytes
Newer Older
Adam Procter's avatar
Adam Procter committed
1
<template>
Adam Procter's avatar
Adam Procter committed
2
3
4
5
  <div
    class="nodes"
    v-for="(nodes, index) in otherNodes.otherNodes"
    :key="index"
Adam Procter's avatar
Adam Procter committed
6
7
8
    :style="{
      backgroundColor: nodes.node_color,
    }"
Adam Procter's avatar
Adam Procter committed
9
  >
Adam Procter's avatar
Adam Procter committed
10
11
    <p class="readmode" :id="nodes.node_id">
      {{ nodes.node_text }}
12
    </p>
Adam Procter's avatar
Adam Procter committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'

export default {
  name: 'OtherNodes',

  computed: {
    ...mapState({
      otherNodes: (state) => state.otherNodes,
    }),
  },

  mounted() {
30
    this.$store.dispatch('getOthernodes')
Adam Procter's avatar
Adam Procter committed
31
    setTimeout(this.loadData, 500)
Adam Procter's avatar
Adam Procter committed
32
    setInterval(this.loadData, 5000)
Adam Procter's avatar
Adam Procter committed
33
34
35
36
  },

  methods: {
    loadData() {
37
      this.$store.dispatch('setOthernodes')
Adam Procter's avatar
Adam Procter committed
38
39
40
41
42
    },
  },
}
</script>

Adam Procter's avatar
Adam Procter committed
43
44
45
46
47
48
49
50
<style scoped>
.nodes {
  width: 95%;
  background-color: rgb(155, 194, 216);
  margin-top: 1em;
  margin-left: 0.5em;
}
</style>