0

問題を引き起こしているミックスインがあります:

mixin dialog(title, description, choices)
    form.choices.dialog.row
        legend
            h1 #{title}
            p.description #{description}
        fieldset
            for choice in choices
                label
                    input(type= "radio", name = "choice.name", checked = "checked", required = "required")
                    | choice.name
        div.row.form-actions
            button(type="submit", ) Make Choice

これを呼び出すには、まず、この mixin に mixin ファイルを含めます。

import dialog

次に、javascript 変数を作成した後、mixin を使用します。

- var investiageUFODialog = [{headerText: "Would you like to investiage the UFO?", description: "Choose whether or not to investigate the UFO."}, {choices: [{name: "Yes"}, {name: "No"}]}]

mixin dialog(investiageUFODialog.headerText, investiageUFODialog.description, investiageUFODialog.choices)

私は何を間違っていますか?

4

1 に答える 1

3

investiageUFODialogそのように使用したい場合は、配列にすることはできません。次のように変更するだけです。

- var investiageUFODialog = {headerText: "Would you like to investiage the UFO?", description: "Choose whether or not to investigate the UFO.", choices: [{name: "Yes"}, {name: "No"}]}

また、ミックスインでは、(引用符なしで)書く必要がありますname = choice.name

于 2013-04-01T20:19:00.133 に答える