B
B
beduin012020-02-19 15:06:27
JavaScript
beduin01, 2020-02-19 15:06:27

How to make ref point to a component?

Trying to integrate vis-network with Vue. I am using the plugin https://github.com/r3code/vue-vis-network . An error pops up: "Cannot read property 'hasChildNodes' of undefined". I have a suspicion that the plugin is not looking for data in the data section of the component, but is trying to access #app. How can this be fixed?

Component code:

<template>
    <el-container >
            <el-main>

                <network ref="network" :nodes="nodes" :edges="edges" :options="options"> </network>                        

                 <button @click="get_data">GetData</button>

            </el-main>
  </el-container>
</template>

<script>
    export default {
    	components: { Notification },
        data () {
            return {
              nodes: [],
              edges: [],
              options: []
            }
        },

        methods:
        {
          get_data()
          {

            axios.get(base_url + '/graph')
               .then((response) => {
                this.nodes = response.data.nodes;
                this.edges = response.data.edges;
                }).catch((error) => {
                          console.log(error);
                        });  
          
          }
          
        },


    }
</script>


index.js:
Vue.component('network', new vueVisNetwork.Network);


Possibly related issue https://github.com/crubier/react-graph-vis/issues/57 (the truth about React)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question