Skip to content

Commit

Permalink
feat: 优化透传值,处理空的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
weishuodan committed Nov 20, 2023
1 parent 8537219 commit f8d0bd9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions components/license-plate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,16 @@ export default {
keyboardType,
}
},
// 健值为null特殊处理
keyArrayCopy() {
return this.keyArray.map(item => {
if (item) {
return item
} else {
return ' '
}
})
},
},
created() {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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(''))
}
},
},
Expand Down

0 comments on commit f8d0bd9

Please sign in to comment.