vue用dragstart实现拖拽

<template>
  <div>
    <br/>
    <div @drop="tt()" @dragover.prevent>
      <div>
        {{ test }}
      </div>
    </div>
    <br/>
    <div :draggable="true" @dragover.prevent @dragstart="drag" @click="btnClick">点击</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      test: ['yuan ']
    };
  },
  methods: {
    btnClick() {
    }
    ,
    drag(vm) {
      console.log(vm);
    },
    tt() {
      this.test.push('aaaa')
    }
  }
}
</script>

<style scoped>
</style>

posted @ 2021-07-13 15:04  寒冷的雨呢  阅读(762)  评论(0编辑  收藏  举报