iview table数据排序不正确问题

ascend:上升,升高,动词

descend:下降,动词

key: 'XXX', //如果不写key,排序可能不生效,sortMethod中的a和b取值是undefined
sortable:true,
sortType: 'desc', //初始化排序
sortMethod:(a,b,type) => {
	if(type === 'desc') {
		return parseInt(a) < parseInt(b) ? 1 : -1;
	}else {
		return parseInt(a) > parseInt(b) ? 1: -1;
	}
}

 

posted @ 2025-03-13 16:38  土小狗  阅读(28)  评论(0)    收藏  举报