feat(NumberKeyboard): add number random prop (#7841)

This commit is contained in:
nemo-shen
2021-01-02 12:47:26 +08:00
committed by GitHub
parent 6afd13587f
commit 5137fcf76f
5 changed files with 106 additions and 0 deletions
+9
View File
@@ -59,6 +59,10 @@ export default createComponent({
type: Boolean,
default: true,
},
randomKeyOrder: {
type: Boolean,
default: false,
},
},
watch: {
@@ -84,6 +88,11 @@ export default createComponent({
for (let i = 1; i <= 9; i++) {
keys.push({ text: i });
}
if (this.randomKeyOrder) {
keys.sort(() => (Math.random() > 0.5 ? 1 : -1));
}
return keys;
},