How to implement Vue application to transfer selected options to another page
P粉308089080
P粉308089080 2023-08-28 09:44:23
0
2
446

On the first page of my Vue app, I have a dropdown menu containing a list of email addresses.

I want to save the selected value/text and use it as a parameter or variable on the inbox page I route to.

This is the code for the dropdown menu using v-autocomplete:

  

This is a button that acts as a v-btn and is used to route to the inbox page.

 Load mailbox 

How do I save the value of a selected mailbox for use on the inbox page I route to?

P粉308089080
P粉308089080

reply all (2)
P粉083785014

Pass the selected value as a routing parameter:

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

From the Inbox page you can access via:

$route.params.selectedValue
    P粉038161873

    I suggest you start usingVuex:)

    This is a library that can share reactive data objects throughout your application.

    Here are examples of your possible code:

    // /store/index.js export state: () => { mailbox: '', } export mutation: () => { SET_MAILBOX(state, mailbox) { state.mailbox = mailbox } }
    // your-page.vue  
      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!