1 line
2.1 KiB
JSON
1 line
2.1 KiB
JSON
{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport { computed } from \"vue\";\nimport { useStore } from \"vuex\";\nexport default {\n name: \"OnLinePop\",\n props: {},\n setup() {\n const store = useStore();\n const showOnLine = computed(() => store.state.config.showOnLine);\n const Type = computed(() => store.state.config.$Type);\n const Lang = computed(() => store.state.config.$lang);\n let list = [];\n const getRndInteger = (min, max) => {\n return Math.floor(Math.random() * (max - min)) + min;\n };\n const genUid = () => {\n const length = 9;\n const soupLength = genUid.soup_.length;\n let id = [];\n for (let i = 0; i < length; i++) {\n id[i] = genUid.soup_.charAt(Math.random() * soupLength);\n }\n return `EZ` + id.join(\"\");\n };\n genUid.soup_ = \"0123456789\";\n for (let i = 0; i < 20; i++) {\n const time = getRndInteger(5, 20);\n const money = getRndInteger(4000, 99999);\n const drop = getRndInteger(1, 99) / 100;\n const item = {\n name: genUid(),\n head: getRndInteger(1, 7),\n frame: getRndInteger(1, 5),\n time: time,\n win: parseInt(time * 3.14 * 800) + drop,\n money: (money + drop + parseInt(time * 3.14 * 800)).toFixed(2)\n };\n list.push(item);\n }\n const compare = (key, desc) => {\n //key: 用于排序的数组的key值\n //desc: 布尔值,为true是升序排序,false是降序排序\n return function (a, b) {\n let value1 = a[key];\n let value2 = b[key];\n if (desc == true) {\n // 升序排列\n return value1 - value2;\n } else {\n // 降序排列\n return value2 - value1;\n }\n };\n };\n list = list.sort(compare(\"money\", false));\n const closeOnLine = () => {\n store.commit(\"config/showOnLine\");\n };\n return {\n Type,\n Lang,\n list,\n showOnLine,\n closeOnLine\n };\n }\n};","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]} |