【问题标题】:How to add a index in Tabulator with Vuex?如何使用 Vuex 在 Tabulator 中添加索引?
【发布时间】:2019-01-17 05:53:36
【问题描述】:

我将 Tabulator 与 Nuxtjs 一起使用 一切正常,但是当我想添加 index 时,出现错误

[vuex] 不要在突变处理程序之外改变 vuex 存储状态。

这里是代码


  watch: {
    tableData:{
      handler: function (newData) {
        this.tabulator.replaceData(newData);
      },
      deep: true,
    }
  },
  mounted(){
    this.tabulator = new Tabulator(this.$refs.table, {
      index: 'p',
      data: this.data,
      layout: "fitData",
      columns: [ 
        {title:"Num", field:"p"},
        {title:"pn", field:"pn"},
        {title:"par", field:"par"},
        {title:"typec", field:"typec"},
        {title:"ch", field:"ch"},
        {title:"ar", field:"ar"}, 
      ],
      rowClick:function(e, row){
        $nuxt._router.push({ path: '/C/' + row.getIndex() })
      },

    });
    // test to upade row
    this.tabulator.updateData([{p:1, pn:"test"}, {p:3, prixnom:"test"}]);
  }

谢谢!

【问题讨论】:

    标签: javascript nuxt.js tabulator


    【解决方案1】:

    好的,我找到了 需要添加

    created () {
        this.data = JSON.parse(JSON.stringify(this.rt));
      },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-02
      • 2020-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多