chore: array fill (#8263)

This commit is contained in:
neverland
2021-03-04 14:04:47 +08:00
committed by GitHub
parent 12be46fad8
commit 3fd2972b7c
6 changed files with 19 additions and 36 deletions
+3 -4
View File
@@ -85,10 +85,9 @@ export default createComponent({
const root = ref<HTMLElement>();
const genBasicKeys = () => {
const keys: KeyConfig[] = [];
for (let i = 1; i <= 9; i++) {
keys.push({ text: i });
}
const keys: KeyConfig[] = Array(9)
.fill('')
.map((_, i) => ({ text: i + 1 }));
if (props.randomKeyOrder) {
keys.sort(() => (Math.random() > 0.5 ? 1 : -1));