2 8 2 8 - 30 days ago 12
Javascript Question

Run javascript function when a page loaded in QML

I want to run js function like this

function setPersonalInfoValue(){
console.debug("setPersonalInfoValue()");
}


when the page loaded in qml.
I try:

Rectangle {
id: page2
width: 100
height: 62

function setPersonalInfoValue(){
console.debug("setPersonalInfoValue()");
}
}


I want run setPersonalInfoValue() function when I switch between page 1 to page 2.
How I can do this?

2 8 2 8
Answer Source

I use from this:

Component.onCompleted: {
    setPersonalInfoValue();
}