D
D
Denis2021-05-17 19:46:47
Vue.js
Denis, 2021-05-17 19:46:47

Is it possible to bind blocks/components to an array/object?

Demo I have a draggable
component that contains blocks that I want to change position manually using drag and drop . With a list, everything is easy, but it does not suit me (not sure). Is it possible to somehow bind the blocks/components inside the draggable to an array/object in data so that I can store this data on the back and load it accordingly? In the example, you can see that testList changes in accordance with the movement of the elements of the list. But in the example of moving blocks - list2 changes values, but the blocks themselves do not change their position. This is the effect I want to achieve: gif






Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2021-05-17
@firedragon

Each draggable element has x y width and height. It's all fine to shrink down on the list. What is your problem?

A
Aetae, 2021-05-17
@Aetae

list2has nothing to do with itemunlike testList. In list2you should not lie numbers, but objects with data, according to which the corresponding will be built item, the items themselves must be listed through v-for, so that when they list2change, their order also changes.
What you want to do is probably through the render function and $children, but this library doesn't do that. Yes, and you don't really need it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question