diff --git a/src/components/scrollRankingBoard/src/main.vue b/src/components/scrollRankingBoard/src/main.vue
index 320a593..f349096 100644
--- a/src/components/scrollRankingBoard/src/main.vue
+++ b/src/components/scrollRankingBoard/src/main.vue
@@ -8,7 +8,7 @@
>
No.{{ item.ranking }}
-
{{ item.name }}
+
{{ item.value + mergedConfig.unit }}
@@ -76,7 +76,13 @@ export default {
* @default unit = ''
* @example unit = 'ton'
*/
- unit: ''
+ unit: '',
+ /**
+ * @description Auto sort by value
+ * @type {Boolean}
+ * @default sort = true
+ */
+ sort: true
},
mergedConfig: null,
@@ -137,9 +143,9 @@ export default {
this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})
},
calcRowsData () {
- let { data, rowNum } = this.mergedConfig
+ let { data, rowNum, sort } = this.mergedConfig
- data.sort(({ value: a }, { value: b }) => {
+ sort && data.sort(({ value: a }, { value: b }) => {
if (a > b) return -1
if (a < b) return 1
if (a === b) return 0