【问题标题】:Delete/Edit record in vuejs在 vuejs 中删除/编辑记录
【发布时间】:2018-12-05 08:39:30
【问题描述】:

我正在使用 vuejsbootrap 的 . 我想一次编辑或删除一条记录。

<b-table :items="products" :fields="fields">
  <template slot="actions" slot-scope="row">
    <a @click='editRecord()'><font-awesome-icon icon="edit" /></a> | 
    <a @click='deleteRecord()'><font-awesome-icon icon="trash-alt" 
    /></a>
  </template>
</b-table>

我正在调用 editRecord 和 deleteRecord 但我无法将当前记录对象或 id 传递给方法。

【问题讨论】:

    标签: vue.js


    【解决方案1】:

    使用插槽范围内的row 变量:

    <template slot="actions" slot-scope="row">
      <a @click='editRecord(row)'><font-awesome-icon icon="edit" /></a> | 
      <a @click='deleteRecord(row)'><font-awesome-icon icon="trash-alt"/></a>
    </template>
    

    【讨论】:

    • 非常感谢。现在我对 vuejs 有了一点了解。
    猜你喜欢
    • 1970-01-01
    • 2019-04-08
    • 2018-06-05
    • 2015-05-11
    • 2020-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    相关资源
    最近更新 更多