Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

323
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda