T
T
TerNik2019-02-05 04:01:00
Vue.js
TerNik, 2019-02-05 04:01:00

Vue: how to implement binding loaded svg with data?

Good day!
Please tell me how to implement the task.
There are many SVG schemes.
In the module, the user selects a value, and the corresponding schema is loaded.
After that, I want to make the circuit interactive.
If we immediately loaded the vue module, it would look like this:

<svg>
  <g id='firstPartOfScheme'>
    <paht id='firstPath1' class='a lot of classes' :class='isSelected(1)' @click='onClick(1)'></path>
    <paht id='firstPath2' class='a lot of classes' :class='isSelected(2)' @click='onClick(2)'></path>
  </g>
  <g id='secondPartOfScheme'>
    <paht id='secondPath1' class='a lot of classes' :class='isPreview(1)'></path>
    <paht id='secondPath2' class='a lot of classes' :class='isPreview(2)'></path>
  </g>
</svg>

But what if we only have bare circuits, how to make them interactive?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kokovin, 2019-02-10
@Per_Ardua

You need to make them into vue components dynamically. There is a small article, some of which can help you: https://habr.com/en/post/345814/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question