-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (37 loc) · 1.46 KB
/
index.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
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<title>Document</title>
</head>
<body>
<div id="app">
<section class="output">
<h1><pre>{{current}}</pre></h1>
<h2><pre>{{total}}<span v-if="selected"> {{selected}}</span></pre></h2>
</section>
<section class="modifiers">
<button v-on:click="current = 0, total = 0, selected = null">AC</button>
<button v-on:click="current = -current">+/-</button>
<button v-on:click="current = Number(current) * 0.01 ">%</button>
</section>
<section class="operators">
<button v-for="operator in operators"
v-on:click="calculate(operator)">{{operator}}</button>
<button v-on:click="calculate()">=</button>
</section>
<section class="digits">
<button v-for="digit in [...Array(10).keys()]"
v-on:click=" current === 0 ? current = String(digit) : current += digit" >
{{digit}}
</button>
<button v-on:click="current.toString(),indexOf('.')== -1 ? current += '.': null">.</button>
</section>
</div>
<script src="index.js"></script>
</body>
</html>