1温算、合并el-table
// 處理合并行的數(shù)據(jù)
getSpanArr(data, spanKey) {
const hbList = ['tendersName', 'stage', 'workPointName']
var spanArr = []
var pos = ''
for (var i = 0; i < data.length; i++) {
if (i === 0) {
spanArr.push(1)
pos = 0
} else {
// 判斷當(dāng)前元素與上一個(gè)元素是否相同
const findIndex = hbList.findIndex((item) => item === spanKey)
const list1 = hbList.filter((item, index) => index <= findIndex)
const flag = list1.reduce((prev, cur) => {
return prev && data[i][cur] === data[i - 1][cur]
}, true)
if (flag) {
spanArr[pos] += 1
spanArr.push(0)
} else {
spanArr.push(1)
pos = i
}
}
}
return spanArr
}
2堤如、正則:
/[a-z]/.test(this.password); //小寫
/\d/.test(this.password); //數(shù)字
/[A-Z]/.test(this.password); //大寫