0

index.html ファイルで Enyo アプリ クラスを作成するときに、パラメータを渡そうとしました。私はそれをテストするために以下を持っています

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

そしてjsファイルで

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

これを行う方法はありますか?

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 に答える