-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.html
74 lines (66 loc) · 2.24 KB
/
calculator.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="calculator.css" />
<title>VueJS Calculator</title>
</head>
<body>
<div id="app">
<table>
<tr>
<td class="resultTd" colspan="5">
<div class="resultField" ref="resultScroll">
<ul>
<li v-for="entry in history">{{ entry }}</li>
</ul>
</div>
</td>
<tr>
<tr>
<td class="inputField" colspan="5">
<input v-model="input" v-on:keydown.enter="calculate()" autofocus />
{{ invalidInput }}
</td>
<tr>
<tr>
<td v-on:click="deleteInput('⌫')">⌫</td>
<td v-on:click="appendInput('(')">(</td>
<td v-on:click="appendInput(')')">)</td>
<td v-on:click="appendInput('mod')">mod</td>
<td v-on:click="appendInput('π')">π</td>
</tr>
<tr>
<td v-on:click="appendInput('7')">7</td>
<td v-on:click="appendInput('8')">8</td>
<td v-on:click="appendInput('9')">9</td>
<td v-on:click="appendInput('÷')">÷</td>
<td v-on:click="appendInput('√(')">√</td>
</tr>
<tr>
<td v-on:click="appendInput('4')">4</td>
<td v-on:click="appendInput('5')">5</td>
<td v-on:click="appendInput('6')">6</td>
<td v-on:click="appendInput('×')">×</td>
<td v-on:click="appendInput('²')">x²</td>
</tr>
<tr>
<td v-on:click="appendInput('1')">1</td>
<td v-on:click="appendInput('2')">2</td>
<td v-on:click="appendInput('3')">3</td>
<td v-on:click="appendInput('-')">-</td>
<td v-on:click="undo()">Undo</td>
</tr>
<tr>
<td v-on:click="appendInput('0')">0</td>
<td v-on:click="appendInput('.')">.</td>
<td v-on:click="appendInput('%')">%</td>
<td v-on:click="appendInput('+')">+</td>
<td class="equal-btn" v-on:click="calculate()">=</td>
</tr>
</table>
</div>
<script type="module" src="calculator.js"></script>
</body>
</html>