提交 c586f81b 编写于 作者: 杨广俊's avatar 杨广俊

排序问题

上级 46c6682f
......@@ -12,7 +12,7 @@
<div class="tea-img" :style="'background:'+ item.bgColor">
<!-- <img :src="item.doctorAvatarImg"> -->
<img :src="item.doctorImg">
<span class="learn-p">{{item.totalNum | yLocalString}}人已学</span>
<span class="learn-p">{{item.joinNum | yLocalString}}人已学</span>
<span class="learn-p-cnum">课程: 共{{item.resourceNum}}</span>
</div>
<div class="tea-txt">
......
......@@ -82,18 +82,18 @@ export function arraySort(originData, isUp = true, sortedField, converFun) {
sourceB = converFun(sourceB[sortedField])
}
}
if(!sourceA || !sourceB) {
sourceA = 0
sourceB = 0
}
// if(!sourceA || !sourceB) {
// sourceA = 0
// sourceB = 0
// }
if(isUp) {
if(sourceA - 0 > sourceB - 0) {
if((sourceA - 0) > (sourceB - 0)) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
}
} else {
if(sourceA - 0 < sourceB - 0) {
if((sourceA - 0) < (sourceB - 0)) {
swap = sortedData[j]
sortedData[j] = sortedData[j + 1]
sortedData[j + 1] = swap
......
......@@ -137,6 +137,7 @@ export default {
orderAction(orderName, isSortUp) {
let orderType = isSortUp ? -1 : 1;
let orderData = this.oldParmDataDoctList.slice();
console.log('orderData1: ', orderName, orderData)
if (orderName === "doctorFirstNameChar") {
orderData = arraySort(orderData, isSortUp, orderName, fieldValue => {
return fieldValue.charCodeAt(0);
......@@ -148,6 +149,7 @@ export default {
} else {
orderData = arraySort(orderData, isSortUp, orderName);
}
console.log('orderData2: ', orderName, orderData)
this.parmDataDoctList = orderData;
},
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册