Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
How to get X,Y coordination after release the Click + Move the mouse at same time - VueJs

I am using Vuedraggable Component which has a Element.

It gets draggable when click + move the mouse across the screen. After releasing the click from the mouse, I want to get a X,Y coordination where we release the mouse move position.

Here is my sample code,

<draggable class="dragArea list-group" :list="list1" @change="log">
    <div
      v-for="element in list1"
      :key="element.name"
      class="list-group-item"
    >
      <button class="button button--line" @change="down" @click="up">
        {{ element.name }}
      </button>
    </div>
  </draggable>

  import draggable from 'vuedraggable';
  
  export default {
       name: 'test',
       data: () => {
            return {
                list1: [{ name: 'Signature Draggable', id: 1 }],
            }
       },
       methods: {
              down(e) {
                    console.log('>>>>>>>>>>>>>>>>1111121');
                    e.target.offsetLeft - e.clientX, e.target.offsetTop - e.clientY;
              },
             up(event) {
                    console.log('###############1111121');
             }
       }

Kindly help me to get the X,Y Coordination.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use the mouse-up event(v-on:mouseup).

<template>
  <div v-on:mousedown="down($event)" v-on:mouseup="up($event)" style="background-color:blue; width:500px;height:500px">
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {}
  },
  methods: {
    up: function (e) {
      console.log('X: ' + e.offsetX + ' Y: ' + e.offsetY)
    },
    down: function (e) {
      console.log('X: ' + e.offsetX + ' Y: ' + e.offsetY)
    }
  }
}
</script>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda