question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use function vue in components HTML

See original GitHub issue

In vuejs function I use Library function this.editor.addNode and i used "@click=“Clicked” It’s not working in vuejs You can recommend for using in vuejs

card_devices: ' <div class="card-devices" > <div class="header"> <h1> Test </h1> </div> <div class="body" > <span @click="Clicked"> Name :</span> </div> </div> </div> '

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
myshinjiocommented, Aug 23, 2020

It’s working Thank you very help full. 👍

1reaction
jerosolercommented, Aug 23, 2020

Hello @myshinjio

For vue you have to register the components.

Example: App.vue

<template>
  <div id="app">
    <div id="drawflow"></div>
  </div>
</template>

<script>
import Vue from 'vue'
/*eslint-disable */
import NodeClick from './components/NodeClick.vue'
import Drawflow from 'drawflow'
import styleDrawflow from 'drawflow/dist/drawflow.min.css' // eslint-disable-line no-use-before-define
/*eslint-enable */


export default {
  name: 'App',
  data() {
    return {
      editor: null,
    }
  },
  mounted() {
    const id = document.getElementById("drawflow");
    this.editor = new Drawflow(id, Vue);
    this.editor.start();
    const props = {};
    const options = {};
    this.editor.registerNode('NodeClick', NodeClick, props, options);
    const data = {};
    this.editor.addNode('Name', 0, 1, 150, 300, 'Class', data, 'NodeClick', 'vue');

  },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
#drawflow {
  width: 100%;
  height: 500px;
  border: 1px solid red;
}
</style>

Component NodeClick

<template>
  <div class="card-devices" >
     <div class="header">
        <h1> Test </h1>
     </div>
    <div class="body" >
       <span @click="Clicked"> Name :</span>
     </div>
  </div>
</template>

<script>
export default {
  methods: {
    Clicked() {
      alert("hello-drawflow");
    }
  }
}
</script>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Components Basics - Vue.js
Components allow us to split the UI into independent and reusable pieces, and think about each piece in isolation. It's common for an...
Read more >
Vue.js add function to a component - Stack Overflow
I am using Vue.js and I would like to add a function to my component, Map.vue, so when I click the button it...
Read more >
Vue.js functional components: what, why, and when? - Medium
Functional components (not to be confused with Vue's render functions) is a component which holds no state and no instance. In more plain...
Read more >
Functional Components in Vue.js - DigitalOcean
render context and returns the rendered HTML. ; FunctionalButton component: ; App.vue component where you import FunctionalButton.js to use it in ...
Read more >
Vue.js Methods - GeeksforGeeks
A Vue method is an object associated with the Vue instance. Functions are defined inside the methods object. Methods are useful when you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found