OtherNodes.vue 833 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
12
13
14
    <p
      class="readmode"
      :id="nodes.node_id"
      v-html="marked(nodes.node_text)"
    ></p>
Adam Procter's avatar
Adam Procter committed
15
16
17
18
19
20
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'
Adam Procter's avatar
Adam Procter committed
21
import marked from 'marked'
Adam Procter's avatar
Adam Procter committed
22
23
24
25
26
27
28
29
30
31
32

export default {
  name: 'OtherNodes',

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

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

  methods: {
    loadData() {
40
      this.$store.dispatch('setOthernodes')
Adam Procter's avatar
Adam Procter committed
41
    },
Adam Procter's avatar
Adam Procter committed
42
    marked,
Adam Procter's avatar
Adam Procter committed
43
44
45
46
  },
}
</script>

Adam Procter's avatar
Adam Procter committed
47
<style scoped>
Adam Procter's avatar
Adam Procter committed
48
.nodes {
Adam Procter's avatar
Adam Procter committed
49
  border: 2px solid black;
Adam Procter's avatar
Adam Procter committed
50
}
Adam Procter's avatar
Adam Procter committed
51
</style>