vue-moveable
vue-moveable copied to clipboard
Single moveable control box
It has props of target in moveable. Each time the target changes, the moveable box changes.
But only vue is different.
- vanilla
moveable.target = document.querySelector("'target');
- react
<Moveable target={document.querySelector(".target")} />
- Angular
<ngx-moveable [target]="document.querySelector("'target')"/>
- vue
<vue-moveable>
<div class="target"></div>
</vue-moveable>
https://github.com/daybrush/moveable/issues/55
Hey @daybrush Thanks for your issue
I guess it's wise to support both versions, e.g.
<vue-moveable :target="document.querySelector(".target")">
<div class="target"></div>
</vue-moveable>
and
<!-- single target -->
<vue-moveable>
<div class="target"></div>
</vue-moveable>
<!-- multiple targets -->
<vue-moveable>
<div class="target"></div>
<div class="target"></div>
</vue-moveable>
What do you think?
@probil
is it possible?
<vue-moveable :target="document.querySelector('.target')" />
<div class="target"></div>
right now - no. But I can implement it
@probil
is it possible?
<vue-moveable :target="document.querySelector('.target')" /> <div class="target"></div>
I don't think it's possible in general. Vue will look for document
key on the component instance. So such code will throw an error. I guess I would need to pass a selector, e.g.
<vue-moveable target=".target" />
I am not a vue expert, therefore no pull request from my side, but I have tested locally following:
I have added to MOVEABLE_PROPS array the target
, as props I added target: [HTMLElement]
, changed the init call of moveable to target: this.target
and removed from the template the slot
It seems to work without error in my configuration.
Would be nice, if it works for you as well and you can add the changes.
@markusnissl Thanks for your feedback.
Some work regarding that was done in v1.6
I'll try to find some time this weekend to make it work properly
Thanks for your great work on this @probil,
But I also find it very useful to add support for groups and also make the API the same as the other libraries. I've had a lot of confusion looking at the examples and just realised that this isn't supported in vue-moveable
.
It'd be great if we could have support for groups and not having target passed as slots necessarily! I guess, for now, I would fall back to the vanilla implementation since I need the grouping to work. I am looking forward to having this feature.
Any updates ?