Skip to content

2.0 changes #33

Open
Open
@Astray-git

Description

@Astray-git

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions