表中的作用域字段槽有一个新语法,请参阅https://bootstrap-vue.js.org/docs/components/table#scoped-field-slots,它看起来像
<template v-slot:cell(myColumn)="data">
...
Run Code Online (Sandbox Code Playgroud)
wheremyColumn被解释为字符串 - 字段中的字段键,以显示在我们的表中。
如何使用变量而不是字符串?让我们说一下:
let myColumnName = "myColumn";
<template v-slot:cell(myColumnName)="data">
...
Run Code Online (Sandbox Code Playgroud)