0

vue-draggable用来将一些元素拖到div1and div2。Draggable 事件:move只有在teamName1大于 1 时才为真。如果teamname1大于 1,它可以拖动到 div1 以及 div2,这基本上是错误的。有没有办法添加:move:checkMove2,例如当teamName2值> 1时,第二个div:move:checkMove1的可拖动事件变为:move="checkMove2"真?我尝试使用,但没有帮助。:move="checkMove1 && checkMove2"

<!-- Div 1 :move="checkMove1" where the draggable is true if teamName1 is greater than 1 -->

<div>
<b-form-input id="input-small" size="md" v-model="teamName1"></b-form-input>
</div>

<!-- Is there a way to add :move="checkMove2" to the below div '2' as well, where the draggable will
 be true if teamName2 is greater than 1 ?? -->

<div>
<b-form-input id="input-small" size="md" v-model="teamName2"></b-form-input>
</div>

<draggable :list="text.people" class="list-group" draggable=".item" group="a" :move="checkMove1" @add="person">
  <div class="list-group-item item" v-for="element in text.people" :key="element.name">
    <p>{{element.first_name}}</p>
  </div>
</draggable>

数据

teamName1: '',
teamName2: ''

方法

checkMove1(evt){
  if(this.teamName1.length < 1){
    return false;
   }
 },

checkMove2(evt){
  if(this.teamName2.length < 1){
     return false
  }
},
4

0 回答 0