0

I was going to try in pass in parameters when I create my Enyo app class in the index.html file. I have the following to test it

new MyApps.MainApp("test").renderInto(document.body);

and in the js file

create: function(in)
{
    Alert(in);
}

Is there a way to do this?

4

2 回答 2

2

你真的,真的很亲近。如果您想在应用程序的种类上设置一些变量,那么您需要像传递给任何其他种类的参数一样。尝试:

 new MyApps.MainApp({test: true}).renderInto(document.body);

然后,您应该能够访问 test 的值:this.test

希望有帮助。

于 2012-01-04T21:53:58.670 回答
0
new MyApps.MainApp({test: true}).renderInto(document.body);

...

enyo.kind({
    name: "MyApps.MainApp",
    kind: enyo.VFlexBox,
    components: [],
    create: function(inArgs) {
        var args = inArgs;
        if (args.test) {
            this.log("SUCCESS");
        }

        this.inherited(arguments);
    }
});

类似的东西。

于 2012-01-10T20:48:04.950 回答