Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="vue-example">
  <div class="input-model">
    <input v-model="newTodoText" v-on:keyup.enter="addNewTodo" placeholder="Add a todo">
  </div>
  <div id="drag-scope">
    <div class="column">
      <div class="title">Tasks</div>
      <todo-container class="regular  green lighten-5" :data="todos.regular">
        <todo-item v-for="(todo, index) in todos.regular" :data="todo" @remove="todos.regular.splice(index, 1)"></todo-item>
      </todo-container>
    </div>
    <div class="column">
      <div class="title">High Priority</div>
      <todo-container class="priority red lighten-4" :data="todos.priority">
        <todo-item v-for="(todo, index) in todos.priority" :data="todo" @remove="todos.priority.splice(index, 1)"></todo-item>
      </todo-container>
    </div>
    <div class="column">
      <div class="title">Done</div>
      <todo-container class="done grey lighten-2" :data="todos.done">
        <todo-item v-for="(todo, index) in todos.done" :data="todo" @remove="todos.done.splice(index, 1)"></todo-item>
      </todo-container>
    </div>
  </div>
  <pre>{{$data|json}}</pre>
  <div>More Examples available <a href="https://supraniti.github.io/Lean-Mean-Drag-and-Drop/">here</a></div>
</div>
              
            
!

CSS

              
                #vue-example {
  width: 100%;
  margin-top: 15px;
  margin-bottom: 15px;
}

#drag-scope {
  display: flex;
  justify-content: space-around;
  background-color: white;
}

.column {
  flex: 1 1 350px;
}

.todo-container {
  display: flex;
  padding: 10px;
  margin: 10px;
  flex-flow: column nowrap;
  min-height: 106px;
}

.todo-item {
  padding: 3px;
  margin: 5px;
  color: black;
  font-size: 15px;
  background-color: grey;
  border: 3px solid lightgoldenrodyellow;
}

.regular .todo-item {
  background-color: #8bc34a;
}

.priority .todo-item {
  background-color: #E57373;
}

.done .todo-item {
  background-color: lightgrey;
  color: gray;
  text-decoration: line-through;
}

.handle {
  cursor: move;
}

.remove {
  color: red;
  float: right;
  cursor: pointer;
}

.task {
  border: 1px dotted white;
  padding: 5px;
}

.title {
  text-align: center;
  font-weight: bold;
  padding: 10px;
  margin: 5px;
}

.input-model {
  padding: 0px 30px;
}
              
            
!

JS

              
                Vue.component('todo-container', {
  template: '<div class="todo-container"><slot></slot></div>',
  props: ['data']
});
Vue.component('todo-item', {
  template: `
<div class="z-depth-3 todo-item">
<div class="content lmdd-block">
<i class="material-icons handle">reorder</i>
<a class="remove" @click="$emit('remove')"><i class="material-icons">clear</i></a>
<div class="task">{{data}}</div>
</div>
</div>
`,
  props: ['data']
})
var vueExample = new Vue({
  el: '#vue-example',
  data: {
    newTodoText: '',
    todos: {
      regular: [
        'Do the dishes',
        'Take out the trash',
        'Mow the lawn'
      ],
      priority: [],
      done: []
    }
  },
  mounted: function() {
    lmdd.set(document.getElementById('drag-scope'), {
      containerClass: 'todo-container',
      draggableItemClass: 'todo-item',
      handleClass: 'handle',
      dataMode: true
    });
    this.$el.addEventListener('lmddend', this.handleDragEvent);
  },
  methods: {
    handleDragEvent: function(event) {
      var newIndex = event.detail.to.index;
      var oldIndex = event.detail.from.index;
      var newContainer = event.detail.to.container.__vue__.data;
      var oldContainer = event.detail.from.container.__vue__.data;
      if (event.detail.dragType === 'move') {
        newContainer.splice(newIndex, 0, oldContainer.splice(oldIndex, 1)[0]);
      }
    },
    addNewTodo: function() {
      this.todos.regular.push(this.newTodoText)
      this.newTodoText = ''
    }
  }
})
              
            
!
999px

Console