code refactor
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
<script>
|
||||
import { arrayContainsFieldvalue } from '@/lib/common.js';
|
||||
import { getColorsInRows } from '@/lib/color.js';
|
||||
import { scrollToSelectedItem } from '@/lib/ui.mobile.js';
|
||||
|
||||
export default {
|
||||
@@ -53,20 +54,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
allColorRows() {
|
||||
const ret = [];
|
||||
let rowCount = -1;
|
||||
|
||||
for (let i = 0; i < this.allColorInfos.length; i++) {
|
||||
if (i % this.itemPerRow === 0) {
|
||||
ret[++rowCount] = [];
|
||||
}
|
||||
|
||||
ret[rowCount].push({
|
||||
color: this.allColorInfos[i]
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
return getColorsInRows(this.allColorInfos, this.itemPerRow);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user