-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlotto.html
37 lines (35 loc) · 900 Bytes
/
lotto.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lotto</title>
</head>
<body>
<div id="app">
<ul>
<li v-for="number in myNumbers">{{ number }}</li>
</ul>
<button @click="getNumbers">Get Lotto</button>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
const vue = new Vue({
el: "#app",
data: {
numbers: _.range(1, 46),
myNumbers: [],
},
methods: {
getNumbers() {
// numbers에서 랜덤으로 6개 추출
this.myNumbers = _.sampleSize(this.numbers, 6)
// 정렬
this.myNumbers.sort((a, b) => a - b)
}
}
})
</script>
</body>
</html>