feat: 优化透传值,处理空的情况

This commit is contained in:
weishuodan 2023-11-20 09:59:50 +08:00
parent 8537219b56
commit f8d0bd9ef5
1 changed files with 13 additions and 3 deletions

View File

@ -367,6 +367,16 @@ export default {
keyboardType,
}
},
// null
keyArrayCopy() {
return this.keyArray.map(item => {
if (item) {
return item
} else {
return ' '
}
})
},
},
created() {
@ -380,7 +390,7 @@ export default {
if (!this.showDivisionKeyboard) {
this.showDivisionKeyboard = true
//
this.$emit('sdKeyboard')
this.$emit('sdKeyboard', this.keyboardViewId)
}
//
if (!this.keyArray[index + 1] && !this.keyArray[index - 1] && index > 0) {
@ -423,7 +433,7 @@ export default {
if (this.modeShow === 'division') {
this.hideDivisionKeyboard()
}
this.$emit('confirm', this.keyArray.join(''))
this.$emit('confirm', this.keyArrayCopy.join(''))
},
//
hideDivisionKeyboard(e) {
@ -434,7 +444,7 @@ export default {
if (this.showDivisionKeyboard && !isKeyboard) {
this.showDivisionKeyboard = false
//
this.$emit('hdKeyboard', this.keyArray.join(''))
this.$emit('hdKeyboard', this.keyArrayCopy.join(''))
}
},
},