onChange(event) { console.lo" /> onChange(event) { console.lo" /> onChange(event) { console.lo"/>

common layout page trigger all pages vue 3

34 Views Asked by At

AppTopbar.vue

<Dropdown v-model="selected" :options="storesLists" @change="onChange" 
optionLabel="name" :filter="true" />

 onChange(event) {
        console.log(event.value.value);
         localStorage.setItem('shopid'); 
         
        
         }
    },

Products.vue

import { useLayout } from '@/layout/composables/layout';


<template>
</template>

AppTopbar is common layout of all pages. when i click onchange AppTopbar.vue is only affectet AppTopbar page only. but i want to if onchange AppTopbar.vue to triger Products.vue and all pages also

how to solve this?

1

There are 1 best solutions below

0
johan On

Use a store: https://pinia.vuejs.org/

Set the value in the store and it is available everywhere.