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

319
Vistas
How can i sync scroll event of two vue components in non parent-child relation?

How can i sync scroll event of two vue component i a non-parent-child relation

Scrolling here ...

BaseLayout.vue

<script setup>
...
function logScrolling(event) {
  console.log("Scrolling to " + event.detail.currentY);
  // rightIonContent.value.$el.scrollToPoint(X, Y, 500); // this is not working
}
...
</script>

<template>
...
    <ion-content :scroll-events="true" @ionScroll="logScrolling($event)" >
      <slot />
    </ion-content>
...
</template>

should be synced with:

AppMenuRight.vue

<script setup>
function ScrollingToPoint(X, Y) {
  rightIonContent.value.$el.scrollToPoint(X, Y, 500);
}
</script>

<template>
...
    <ion-content :scroll-events="true" ref="rightIonContent">
    ...
    </ion-content>
...
</template>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

BaseLayout should set scroll value in vuex store. Than Other component can watch that property and set element scroll value accordingly in the watcher

about 4 years ago · Juan Pablo Isaza Denunciar

0

I have used the option with useEmitter.js described here: Vue.js 3 Event Bus

import { getCurrentInstance } from 'vue'

export default function useEmitter() {
    const internalInstance = getCurrentInstance(); 
    const emitter = internalInstance.appContext.config.globalProperties.emitter;

    return emitter;
}
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