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

301
Vistas
How transfer a selected option to another page in vue application?

On the first page of my Vue application, I have a drop-down menu that contains a list of mailboxes.

I would like to save the value/text of the selection and use it as a parameter or variable on the Inbox page that I routed to.

Here is the drop-down code using v-autocomplete:

<v-autocomplete dense
  filled
  label="Choose Mailbox"
  v-model="mailboxes"
  :items="mailboxes"
  item-text='mailbox'
  item-value='mailbox'>
</v-autocomplete>

Here is the button as v-btn that routes to the Inbox page.

<v-btn rounded color="primary" 
  @click="$router.push('Inbox')">
Load Mailbox</v-btn>

How do I save the selected mailbox value to use on the routed-to Inbox page?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I suggest you to get started with Vuex :)

It's a library that share a reactive data object across the whole app.

Here is what it could look like for you:

// /store/index.js

export state: () => {
   mailbox: '',
}

export mutation: () => {
   SET_MAILBOX(state, mailbox) {
      state.mailbox = mailbox
   }
}
// your-page.vue
<template>
    <v-autocomplete
        v-model="mailboxes"
        dense
        filled
        label="Choose Mailbox"
        :items="mailboxes"
        item-text='mailbox'
        item-value='mailbox'>
      </v-autocomplete>
</template>

<script>
export default {
   computed: {
      mailboxes: {
         get() {
            this.$store.state.mailbox // Get the value from the Vuex store
         },
         set(newMailbox) {
            this.$store.commit('SET_MAILBOX', newMailbox) // Update the Vuex store
         },
      }
   }
}
</script>
over 4 years ago · Santiago Trujillo Denunciar

0

Passing the selected value as a route parameter:

$router.push({
    name: "Inbox",
    params: { selectedValue: YOUR_VALUE }
  });

In the Inbox page, you can access it through:

$route.params.selectedValue
over 4 years ago · Santiago Trujillo Denunciar

0

Other easy solution is to use browser local storage. Vue Client-Side Storage

over 4 years ago · Santiago Trujillo 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