shop_app/pages/groups/StickyCalculate.js

30 lines
505 B
JavaScript
Raw Permalink Normal View History

2025-05-08 09:16:37 +08:00
const StickyCalculate = class {
typeIdMap = []
fixArr = []
constructor(type) {
this.typeIdMap = type;
}
opFixArr(typeId, isFix) {
let index = this.fixArr.indexOf(typeId)
if (isFix && (index == -1)) {
this.fixArr.push(typeId)
} else if ((!isFix) && (index > -1)) {
this.fixArr.splice(index, 1)
}
return this
}
getActionId() {
let index = this.fixArr.length - 1
if (index < 0) {
return 0
} else {
return this.typeIdMap[index]
}
}
}
export default StickyCalculate