【问题标题】:vuejs get data on <input type="hidden"vuejs 在 <input type="hidden" 上获取数据
【发布时间】:2018-01-08 20:55:54
【问题描述】:

当我尝试获取列表的数据“Id”时,脚本的 Id 错误。

我需要那个字段的 ID。但我的回报是错误的

<input type="hidden" name="Id" id="Id"  v-mode="todo.Id">

我一直使用隐藏,因为如果不使用隐藏输入,我无法获得该 ID

</tr>
    <tr  v-for="todo in todos">
    <td>{{todo.filial}} Id {{todo.Id}}<input type="hidden" name="Id" id="Id"  v-mode="todo.Id"></td>


    Deletar: function (event){
        alert($('#Id').val());
        /*$.post( "Salva.php", { textoDoFormulario: this.todosView.Id, status: "delete"  } );
        $.get('t2576.php', function(resp) {
                todosView.todos = resp;
        }, "json");*/
    },

【问题讨论】:

  • 添加正确的代码。目前对我来说它看起来很垃圾。
  • 对于初学者,您可能想要v-model,而不是v-mode

标签: vue.js vuejs2


【解决方案1】:

v-model 不适用于隐藏输入。 related issue

【讨论】:

    猜你喜欢
    • 2015-05-09
    • 1970-01-01
    • 1970-01-01
    • 2013-04-24
    • 2011-03-10
    • 1970-01-01
    • 2020-02-25
    • 1970-01-01
    • 2015-07-29
    相关资源
    最近更新 更多