Open akira32 opened 2 months ago
I had solved this problem by watch.
//store
mutations: {
setScannedData(state, payload) {
state.scannedData = payload;
}
},
//HomePage.vue
export default {
setup() {
const store = useStore();
const scannedData = computed(() => store.state.scannedData);
watch(scannedData, (newValue, oldValue) => {
if (newValue) {
onScannedReceive(newValue.id, newValue.barcodeText);
}
});
I have a HomePage that have two scan buttons. I wish I click one of scan button of HomePage, its will call onScanned function of ScannerPage and then call someone function of HomePage? Does someone know how do I reach to this goal? I need a callback function in HomePage that can do something. Example of getting some data from some web. Two scan buttons have individual functions.
My ScannerPage.vue onScanned code as below: