<template>
<div id="app">
<div>
<button @click="generateRandomNumbers">一次生成5注排列5号码</button>
<ul>
<li v-for="number in randomNumbers" :key="number">{{ number }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: 'app',
data() {
return {
randomNumbers: []
}
},
mounted() {
},
methods: {
generateRandomNumbers() {
// 生成5注随机的5位数
const min = 0;
const max = 99999;
for (let i = 0; i < 5; i++) {
const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
this.randomNumbers.push(randomNumber);
}
}
}
}
</script>
<style scoped="scoped">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
</style>
网友评论