如果v-for中带space的数组对象名

If the object name of array with space in v-for

对象名有space,如'Apple Juice','Orange Juice',那么如何在v-for中使用呢?

<div id="box" v-if="!loading">
  <table>
    <thead>
      <tr>
        <th>Name</th>
        <th>Total Sales</th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="name in Beverage" v-bind:key="name">
        <td>{{name.Txn Group}}</td> //error
        <td>{{name.TotalSales}}</td>
      </tr>
    </tbody>
  </table>
</div>

我调用了 API 并获得了 JSON 数据,所以我无法更改对象名称。 谢谢

你可以像{{ name['Txn Group'] }}那样写,它会正常工作。