-
Notifications
You must be signed in to change notification settings - Fork 21
/
butterfly.html
298 lines (258 loc) · 8.59 KB
/
butterfly.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!doctype html>
<html lang="zh-CN">
<head>
<!-- 必须的 meta 标签 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap 的 CSS 文件 -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
<style>
.form-group.col-md-4 {
display: flex;
align-items: center;
margin-bottom:20px;
}
label {
margin-right:5px;
}
input {
margin-right:5px;
}
</style>
<title>基于fibonacci的蝴蝶战法数据计算</title>
</head>
<body>
<div class="alert alert-dark" role="alert">
欢迎试用 蝴蝶战法计算公式
</div>
<div class="container" id="app">
<div class="form-row" >
<div class="form-group col-md-4">
<label class="mr-2 col-form-label-sm">X</label>
<input type="text" class="form-control form-control-sm" placeholder="X" v-model="X">
<label class="mr-2 col-form-label-sm">A</label>
<input type="text" class="form-control form-control-sm" placeholder="A" v-model="A">
<label class="mr-2 col-form-label-sm">B</label>
<input type="text" class="form-control form-control-sm" placeholder="B" v-model="B">
<label class="mr-2 col-form-label-sm">C</label>
<input type="text" class="form-control form-control-sm" placeholder="C" v-model="C">
<label class="mr-2 col-form-label-sm">D</label>
<input type="text" class="form-control form-control-sm" placeholder="D" v-model="D">
</div>
</div>
<div class="form-row">
<div class="form-group col-lg-12">
<!--button type="submit" class="btn btn-primary btn-sm">Add</button-->
<label>你可以在上面挨个输入数字,也可以一次粘贴5个数字到这里。用空格分开,例如:20 30 40 50 20</label>
<input type="text" class="form-control form-control-sm" placeholder="输入5个数用空格分开" v-model="point5">
<label style="display:none;">{{point5split}}</label>
</div>
</div>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">0.382</th>
<th scope="col">0.618</th>
<th scope="col">0.786</th>
<th scope="col">1.27</th>
<th scope="col">1.618</th>
<th scope="col">2.24</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">XA->B:{{B}}</th>
<td>{{XA382}}</td>
<td>{{XA618}}</td>
<td>{{XA786}}</td>
<td>NULL</td>
<td>NULL</td>
<td>NULL</td>
</tr>
<tr>
<th scope="row">AB->C:{{C}}</th>
<td>{{AB382}}</td>
<td>{{AB618}}</td>
<td>{{AB786}}</td>
<td>NULL</td>
<td>NULL</td>
<td>NULL</td>
</tr>
<tr>
<th scope="row">BC->D:{{D}}</th>
<td >NULL</td>
<td>{{BC618}}</td>
<td>{{BC786}}</td>
<td>{{BC127}}</td>
<td>{{BC1618}}</td>
<td>{{BC224}}</td>
</tr>
<tr>
<th scope="row">XA->D:{{D}}</th>
<td>NULL</td>
<td>NULL</td>
<td>NULL</td>
<td>{{XA127}}</td>
<td>{{XA1618}}</td>
<td>{{XA224}}</td>
</tr>
</tbody>
</table>
<!-- Content here -->
</div>
<!-- JavaScript 文件是可选的。从以下两种建议中选择一个即可! -->
<!-- 选项 1:包含 Popper 的 Bootstrap 集成包 -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
<!-- 选项 2:Popper 和 Bootstrap 的 JS 插件各自独立 -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-SR1sx49pcuLnqZUnnPwx6FCym0wLsk5JZuNx2bPPENzswTNFaQU1RDvt3wT4gWFG" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script>
-->
</body>
<script>
function approx(r1,r2){
if (0.93<(r1 / r2) && (r1/ r2)<1.07){
return " ->√"
}
return ""
}
const VueApp = {
data() {
return {
X:0.0,
A:0.0,
B:0.0,
C:0.0,
D:0.0,
point5:'输入5个数字用空格分开',
}
},
created() {
},
computed: {
// 计算属性的 getter
XA382: function () {
// `this` 指向 vm 实例
result = this.A - (this.A-this.X)*0.384
result =parseFloat(result)
pre = approx(result,this.B)
return result.toFixed(3) + pre
},
XA618: function () {
// `this` 指向 vm 实例
result = this.A - (this.A-this.X)*0.618
result =parseFloat(result)
pre = approx(result,this.B)
return result.toFixed(3) + pre
},
XA786: function () {
// `this` 指向 vm 实例
result= this.A - (this.A-this.X)*0.786
result =parseFloat(result)
pre = approx(result,this.B)
return result.toFixed(3) + pre
},
XA127: function () {
// `this` 指向 vm 实例
result= this.A - (this.A-this.X)*1.27
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
XA1618: function () {
// `this` 指向 vm 实例
result= this.A - (this.A-this.X)*1.618
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
XA224: function () {
// `this` 指向 vm 实例
result= this.A - (this.A-this.X)*2.24
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
AB382: function () {
// `this` 指向 vm 实例
B = parseFloat(this.B)
A = parseFloat(this.A)
result = B + (A-B) * 0.382
result =parseFloat(result)
pre = approx(result,this.C)
return result.toFixed(3) + pre
},
AB618: function () {
// `this` 指向 vm 实例
B = parseFloat(this.B)
A = parseFloat(this.A)
result = B + (A-B)*0.618
result =parseFloat(result)
pre = approx(result,this.C)
return result.toFixed(3) + pre
},
AB786: function () {
// `this` 指向 vm 实例
B = parseFloat(this.B)
A = parseFloat(this.A)
result= B + (A-B)*0.786
result =parseFloat(result)
pre = approx(result,this.C)
return result.toFixed(3) + pre
},
BC618: function () {
// `this` 指向 vm 实例
result = this.C - (this.C-this.B)*0.618
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
BC786: function () {
// `this` 指向 vm 实例
result = this.C - (this.C-this.B)*0.786
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
BC127: function () {
// `this` 指向 vm 实例
result = this.C - (this.C-this.B)*1.27
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
BC1618: function () {
// `this` 指向 vm 实例
result = this.C - (this.C-this.B)*1.618
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
BC224: function () {
// `this` 指向 vm 实例
result = this.C - (this.C-this.B)*2.24
result =parseFloat(result)
pre = approx(result,this.D)
return result.toFixed(3) + pre
},
point5split:function(){
datas = this.point5.split(" ")
if (datas.length == 5){
this.X = datas[0]
this.A = datas[1]
this.B = datas[2]
this.C = datas[3]
this.D = datas[4]
}
}
},
methods: {
// These methods won't trigger a watcher because we changed only a property of Object/Array,
// not the Object/Array itself
}
}
Vue.createApp(VueApp).mount('#app')
</script>
</html>