Element: bug table增加了default-sort-prop和default-sort-order导致,导致了初始化时也触发了change事件

Created on 9 Jan 2017  ·  6Comments  ·  Source: ElemeFE/element

版本:1.1.3
table应该是加了这两个属性后,导致触发change事件的。

临时解决
handleSortChange(val){
let me=this
console.log(val)
if (val.column){
me.sortValues = {
column:val.column,
order:val.order,
prop:val.prop
}
this.fetchData();
}
},

bug

All 6 comments

@njleonzhang 有兴趣的话可以来看看。

@Leopoldthecoder 我的锅。。。我来看看。

还有个bug,设置了default-sort-prop 后,点其他列的时候,这个默认的没有清除掉

@AaronChen2012 好的,我来看下

@njleonzhang @Leopoldthecoder

2.4.4 版本复现此问题.

重现步骤:

1, 设定 :default-sort
2, 设定 @sort-change

  1. 初始化加载表格数据
  2. getData 方法执行了2次

复现链接:
https://jsfiddle.net/9aL4wozr/4/

目前状况:
初始化需要请求一次, 默认排序又请求了一次.

理想状况:
初始化时应该带入 sort 和 order 仅请求一次.

Was this page helpful?
0 / 5 - 0 ratings