Skip to content

Commit ed0d2c9

Browse files
authored
fix(numberkeyboard): props conflict issue #1486 (#1526)
1 parent 5a9ce12 commit ed0d2c9

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/packages/__VUE/numberkeyboard/index.taro.vue

+6-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="nut-numberkeyboard" ref="root">
1111
<div class="number-board-header" v-if="title">
1212
<h3 class="tit">{{ title }}</h3>
13-
<span class="keyboard-close" @click="closeBoard()">{{ translate('done') }}</span>
13+
<span class="keyboard-close" v-if="type == 'default'" @click="closeBoard()">{{ translate('done') }}</span>
1414
</div>
1515
<div class="number-board-body">
1616
<div class="number-board">
@@ -61,7 +61,7 @@
6161
/>
6262
</div>
6363
</div>
64-
<div class="key-board-wrapper" @click="closeBoard()" v-if="title == ''">
64+
<div class="key-board-wrapper" @click="closeBoard()">
6565
<div :class="['key', 'finish', { activeFinsh: clickKeyIndex == 'finish' }]">
6666
{{ confirmText || translate('done') }}
6767
</div>
@@ -159,8 +159,11 @@ export default create({
159159
if (customKeys.length > 2) {
160160
customKeys = [customKeys[0], customKeys[1]];
161161
}
162+
if (customKeys.length == 2 && props.title && props.type != 'rightColumn') {
163+
customKeys = [customKeys[0]];
164+
}
162165
if (customKeys.length === 1) {
163-
if (props.title) {
166+
if (props.title && props.type != 'rightColumn') {
164167
keys.push({ id: customKeys[0], type: 'custom' }, { id: 0, type: 'number' }, { id: 'delete', type: 'delete' });
165168
} else {
166169
keys.push({ id: 0, type: 'number' }, { id: customKeys[0], type: 'custom' });
@@ -171,11 +174,6 @@ export default create({
171174
{ id: 0, type: 'number' },
172175
{ id: customKeys[1], type: 'custom' }
173176
);
174-
if (props.title) {
175-
keys.push({ id: 'delete', type: 'delete' });
176-
}
177-
} else {
178-
keys.push({ id: 0, type: 'number' });
179177
}
180178
return keys;
181179
}

src/packages/__VUE/numberkeyboard/index.vue

+6-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="nut-numberkeyboard" ref="root">
1313
<div class="number-board-header" v-if="title">
1414
<h3 class="tit">{{ title }}</h3>
15-
<span class="keyboard-close" @click="closeBoard()">{{ translate('done') }}</span>
15+
<span class="keyboard-close" v-if="type == 'default'" @click="closeBoard()">{{ translate('done') }}</span>
1616
</div>
1717
<div class="number-board-body">
1818
<div class="number-board">
@@ -63,7 +63,7 @@
6363
/>
6464
</div>
6565
</div>
66-
<div class="key-board-wrapper key-board-finish" @click="closeBoard()" v-if="title == ''">
66+
<div class="key-board-wrapper key-board-finish" @click="closeBoard()">
6767
<div :class="['key', 'finish', { activeFinsh: clickKeyIndex == 'finish' }]">
6868
{{ confirmText || translate('done') }}
6969
</div>
@@ -171,8 +171,11 @@ export default create({
171171
if (customKeys.length > 2) {
172172
customKeys = [customKeys[0], customKeys[1]];
173173
}
174+
if (customKeys.length == 2 && props.title && props.type != 'rightColumn') {
175+
customKeys = [customKeys[0]];
176+
}
174177
if (customKeys.length === 1) {
175-
if (props.title) {
178+
if (props.title && props.type != 'rightColumn') {
176179
keys.push({ id: customKeys[0], type: 'custom' }, { id: 0, type: 'number' }, { id: 'delete', type: 'delete' });
177180
} else {
178181
keys.push({ id: 0, type: 'number' }, { id: customKeys[0], type: 'custom' });
@@ -183,11 +186,6 @@ export default create({
183186
{ id: 0, type: 'number' },
184187
{ id: customKeys[1], type: 'custom' }
185188
);
186-
if (props.title) {
187-
keys.push({ id: 'delete', type: 'delete' });
188-
}
189-
} else {
190-
keys.push({ id: 0, type: 'number' });
191189
}
192190
return keys;
193191
}

src/sites/mobile-taro/vue/src/dentry/pages/numberkeyboard/index.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<nut-numberkeyboard
1717
type="rightColumn"
1818
v-model:visible="visible3"
19-
randomKeys="true"
19+
:randomKeys="true"
2020
:custom-key="customKey1"
2121
@input="input"
2222
@close="close(3)"
@@ -58,7 +58,7 @@ export default {
5858
const visible6 = ref(false);
5959
const value = ref('');
6060
const customKey1 = reactive(['.']);
61-
const customKey2 = reactive(['.']);
61+
const customKey2 = reactive(['.', 'x']);
6262
const customKey3 = reactive(['X']);
6363
const visibleArr = [visible1, visible2, visible3, visible4, visible5, visible6];
6464
function input(number: any) {}

0 commit comments

Comments
 (0)