如何在黑莓10级联中将var从一个页面传递到另一个页面?

Sel*_*man 2 blackberry-10 blackberry-cascades

如何将数据(ex userid)从一个页面传递到blackberry 10 qml中的另一个页面?

Nis*_*hah 5

您可以在目标页面上创建属性,也可以创建一个java脚本函数来执行此操作.如果要在分配之前验证或执行任何其他操作,则应使用java脚本函数.

Page {
    //targetPage

    property string userid //you can also use alias here

    function initialize(id) {
        userid = id
        //you can also set property of controls here
    }
}
Run Code Online (Sandbox Code Playgroud)

像这样在你的页面上调用它

targetPageid.userid = "user id"
Run Code Online (Sandbox Code Playgroud)

要么

targetPageid.initialize("user id")
Run Code Online (Sandbox Code Playgroud)