zoukankan      html  css  js  c++  java
  • vuedraggable拖拽交换元素位置

    npm i -S vuedraggable
    import vuedraggable from 'vuedraggable';
    <template>
      <vuedraggable class="wrapper" v-model="list">
        <transition-group>
          <div v-for="item in list" :key="item" class="item">
            <p>{{item}}</p>
          </div>
        </transition-group>
      </vuedraggable>
    </template>
    
    <script>
    import vuedraggable from 'vuedraggable';
    
    export default {
      name: 'HelloWorld',
      components: {vuedraggable},
      props: {
      },
      data() {
        return {
          list: [1,2,34,4,54,5]
        }
      },
      updated() {
        console.log(this.list)
      },
      methods: {
      }
    }
    </script>
    <style scoped>
    .wrapper {
      display: flex;
      justify-content: center;
       100%;
    }
    .item{
       300px;
      height: 50px;
      background-color: #42b983;
      color: #ffffff;
    }
    </style>

    中文文档http://www.itxst.com/vue-draggable/tutorial.html

  • 相关阅读:
    IOS之UIKit_Day13
    IOS之UIKit_Day12
    IOS之UIKit_Day11
    IOS之UIKit_Day10
    iOS设计模式之工厂模式
    常用操作
    盒子模式
    block循环使用问题
    IOS-sqlite3
    IOS-View用作控制器
  • 原文地址:https://www.cnblogs.com/xiaobaibubai/p/14689713.html
Copyright © 2011-2022 走看看