쿠폰 번호 리스트 - 4자리 마다 하이픈 추가

This commit is contained in:
Yu Sung 2024-01-02 05:26:24 +09:00
parent 76909fc232
commit 2ea2421f7c
1 changed files with 9 additions and 1 deletions

View File

@ -202,7 +202,7 @@
</template> </template>
<template v-slot:item.couponNumber="{ item }"> <template v-slot:item.couponNumber="{ item }">
{{ item.couponNumber }} {{ formatWithHyphens(item.couponNumber) }}
</template> </template>
<template v-slot:item.isUsed="{ item }"> <template v-slot:item.isUsed="{ item }">
@ -431,6 +431,14 @@ export default {
this.coupon_number_count = null this.coupon_number_count = null
}, },
formatWithHyphens(value) {
const chunks = [];
for (let i = 0; i < value.length; i += 4) {
chunks.push(value.substr(i, 4));
}
return chunks.join('-');
},
async getCouponList() { async getCouponList() {
this.isLoading = true this.isLoading = true
try { try {