Vue.js中的循环变量类似于AngularJS

Bea*_*eat 0 javascript angularjs vue.js

我的vue.js应用程序我想知道v-for指令中的最后一个重复元素.我知道有类似的东西在angularjs$last在其循环变量ngRepeat指令:

<div ng-repeat="(key, value) in myObj">
  <span ng-if="$last">Shows if it is the last loop element</span>
</div>
Run Code Online (Sandbox Code Playgroud)

有没有vue.js我不知道的等价物,或者我必须实现一些自己的逻辑?

小智 5

这个对我有用 :)

<div v-for="(item, index) in items">
    <span  v-if="index === (items.length-1)">This is the last loop element</span>
</div>
Run Code Online (Sandbox Code Playgroud)