如何从 Bootstrap-Vue 重用项目提供程序功能更新 b-table 中的项目异步?

How do I update the items async in a b-table from Bootstrap-Vue reusing the items provider function?

我正在使用 Bootstrap-Vue v2.0.0-rc.11,但我无法理解如何更新 table 内容。我相信这是微不足道的。

我正在使用项目提供程序功能从后端提取我的内容。

        <b-table
                 :items="myProvider"
        >

初始调用使用以下方法工作得很好。

export default {
    methods: {
        myProvider(ctx) {
            let promise = axios.get('/backend?currentPage=' + ctx.currentPage);

            return promise.then((response) => {
                return(response.items || []);
            });
        },

为了复制行项目,我打开了一个模式以输入新名称。我对复制进行了后端调用,效果很好。现在我想刷新 table 中显示的内容以显示新项目。我该怎么做呢?

我能想到的最简单的方法是再次调用项目提供程序函数(此处:'myProvider')。我可以从模式中执行此操作,但我无法提供正确的参数(此处:'ctx')。

是否有事件要 trigger/emit 重新发出后端调用?

我试过类似的东西:

this.$refs.nameOfTable.$forceUpdate()

this.$refs.nameOfTable.$emit('XXX') // XXX = placeholder for various events

感谢任何提示!谢谢。

它隐藏在文档中,但它只是对 table 引用的简单 refresh() 调用。

<b-table ref="table" ... ></b-table>
this.$refs.table.refresh();

来自强制刷新 table 数据 部分 the docs

现在无法刷新

您可以改用 'key' 属性。

<b-table key="key" ... ></b-table>

data() {
  return {
    key: 1
  }

this.key += 1