美文网首页
2024-05-11

2024-05-11

作者: 李先生1818 | 来源:发表于2024-05-10 16:48 被阅读0次
    <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>
    
    

    相关文章

      网友评论

          本文标题:2024-05-11

          本文链接:https://www.haomeiwen.com/subject/pyjefjtx.html