that's my first post. I have a problem with passing an Array from function included in Home.vue to component 'testField' at Result.vue
You can see a function which I want to pass below. showResult() is activated when I click this button:
<ion-button id="finalBtn" color="success" v-on:click="showResult" >Calc It!</ion-button>
//INTO Home.vue methods:{ }
// METHOD WHICH I WANT TO PASS
showResult(){
const powerfulArray= new Array(2);
powerfulArray[0]=new Array(2);
/* DECLARATION ARRAY */
powerfulArray[0][0][0][0][0]=28;
/* INITIALIZING VALUES FOR FIELDS */
},
Home.vue :
import { IonContent, IonHeader, IonPage, IonRadio, IonTitle, IonToolbar,IonButton,IonInput,IonLabel,IonRadioGroup, alertController } from '@ionic/vue';
import { defineComponent } from 'vue';
import { useRouter } from 'vue-router';
// import { routeLocationKey } from 'vue-router';
// import { inject } from 'vue';
export default defineComponent({
name: 'Home',
components: {
IonContent,
IonHeader,
IonPage,
IonTitle,
IonToolbar,
IonButton,
IonInput,
IonLabel,
IonRadio,
IonRadioGroup,
},
data(){
return {
ageGRP:'',
sex:'',
smoking:'',
pressure:'',
cholesterol:'',
}},
methods:{
setup() {
const router = useRouter();
return { router };
},
}
Result.vue :
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar,IonInput,IonLabel } from '@ionic/vue';
import { defineComponent } from 'vue';
// import { useRoute } from 'vue-router';
import showResult from './Home.vue';
export default defineComponent({
name: 'Result',
components: {
IonContent,
IonHeader,
IonPage,
IonTitle,
IonToolbar,
IonInput,
IonLabel,
},
data(){
return {
wartosc: 'TEST'
}
},
methods:{
setup(){
console.log(showResult.powerfulArray[0][0][0][0][0]);
},
}
});
Finally I want value of showResult.powerfulArray to but as you can see I can't use that even in this simply example.