Skip to content

2.0 changes #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Astray-git opened this issue Dec 17, 2016 · 0 comments
Open

2.0 changes #33

Astray-git opened this issue Dec 17, 2016 · 0 comments

Comments

@Astray-git
Copy link
Owner

Astray-git commented Dec 17, 2016

2.0 Changes

Plugin API

Model data flow

To follow one-way data flow in Vuejs 2, model value will not be updated automatically on drake events inside the directive. Updated model will be emitted with events.

Using event bus allow us handle events directly in other components. And we need to update models manually.

For "in component" drag&drop we just update model, but for "cross-component" drop&drop(or copy) actions, target and source needs to be update separately.
Currently a dropTarget is exposed in event payload:

eventTarget = {
  el: target, // Target element
  model: targetModel, // updated model of target component
  expression: targetExpression // the expression for directive
}

Here's a simple example:

function updateModel (vm, dropTarget, dropSource) {
  vm[dropSource.expression] = dropSource.model
  if (dropTarget.el === dropSource.el) { return }
  vm[dropTarget.expression] = dropTarget.model
}

Please try with the new version and leave feedbacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant