如何排除v-for中的最后一项?

Max*_*nov 1 javascript vue.js vue-component

我是JavaScript和 JS 框架的新手。我有以下Vuejs代码片段:

    <div v-for="coefficient in coefficients" class="coefficient">
        <div>
            <span class="name">name:{{coefficient.name}}</span>
            <span class="value">value:{{coefficient.value}}</span>
            <span>---</span>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

这是输出:

name: Ubuntu
value: 1
---
name: MacOS
value: 2
---
name: Windows
value: 3
---
Run Code Online (Sandbox Code Playgroud)

如何排除coefficientsVuejs的最后一项?

Dav*_*vid 5

只是使用 v-for="coefficient in coefficients.slice(0,-1)"

演示