Vue绑定值输入

时间:2017-06-25 10:22:26

标签: javascript vue.js

我有一个输入循环

<li v-for="role in ...">
    {{-some html-}}
</li>

并在

中输入
<input type="text" :data-some="role.name" :value="role.name" name="name" ....>

我可以将它绑定到任何属性(例如数据 - 一些)但我不能将它绑定到value属性。为什么以及如何解决这个问题?

我不能通过

来做到这一点
value="{{role.name}}" 

因为它已弃用

我想要创建另一个数据并使用v-model,因为我只需要输出值

这就是我得到的:

enter image description here

正如您所看到的,role.name已被绑定到自定义attr&#34; data-some&#34;和价值 - 根本不存在。

1 个答案:

答案 0 :(得分:0)

我弄明白了。 问题 - 那部分是我通过

克隆到另一个地方的
def times(chars: List[Char]): List[(Char, Int)] = {
  def rec(charList: List[Char], acc: List[(Char, Int)]): List[(Char, Int)] = charList match {
    case Nil => acc
    case x :: xs => rec(xs.filter(_ != x), (x, charList.count(_ == x)) :: acc)
  }
  rec(chars, List())
}

我期望与原始元素相同的反应行为。

Ofc,这不行。