Rails:v模型VueJS属性

时间:2018-11-19 20:24:07

标签: ruby-on-rails

在表单标签内,我放置了一个hidden_​​field。 该hidden_​​field应该具有“ v-model”属性。 我已经尽力想了:

    # nothing shows up
    = f.hidden_field :model_attribute, "v-model" => "value"

    # that's the one I love the most: it compiles v="{:model=>"value"}"
    = f.hidden_field :model_attribute, v: { model: "value" }

    # it compiles with the underscore
    = f.hidden_field :model_attribute, v_model: "value"

    # this throws a compile error, obviously
    = f.hidden_field :model_attribute, v-model: "value"

    # guess the compiled outcome?
    = f.hidden_field :model_attribute, html: { "v-model" => "value" }

    #same as previous 
    = f.hidden_field :model_attribute, options: { "v-model" => "value" }

铁轨在跟我拧吗? 谁能帮我吗?

1 个答案:

答案 0 :(得分:0)

问问题时。您必须提及,它是 VueJS 属性。

选中此LINK

= f.hidden_field :model_attribute, "v-model": "val"