3
3
<h1 >{{ title }}</h1 >
4
4
<section >
5
5
<span class =" desciption" >{{ desciption }}</span >
6
- <span class =" memory" v-if =" supportMemory && isRenderSetting" >Memory used: {{memoryUsed}} MB.</span >
7
- <div class =" icon" v-if =" isRenderSetting" v-bind:class =" showSetting ? 'active' : ''" v-on:click =" clickIcon" >
6
+ <span id =" time" class =" performance time" ></span >
7
+ <span id =" memory" class =" performance memory" ></span >
8
+ <div class =" icon" v-bind:class =" showSetting ? 'active' : ''" v-on:click =" clickIcon" >
8
9
<svg width =" 25" height =" 25" t =" 1553394278598" viewBox =" 0 0 1024 1024" version =" 1.1" xmlns =" http://www.w3.org/2000/svg" p-id =" 8690" xmlns:xlink =" http://www.w3.org/1999/xlink" >
9
10
<path d="M809.21 474.749H374.022c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966H809.21c19.865 0 35.966-16.107 35.966-35.966 0-19.864-16.101-35.966-35.966-35.966m0 215.796H374.022c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966H809.21c19.865 0 35.966-16.107 35.966-35.966 0-19.865-16.101-35.966-35.966-35.966M220.52 258.954c-19.865 0-35.966 16.101-35.966 35.966 0 19.865 16.101 35.966 35.966 35.966s35.966-16.101 35.966-35.966c0-19.865-16.102-35.966-35.966-35.966m153.502 71.932H809.21c19.865 0 35.966-16.101 35.966-35.966 0-19.865-16.101-35.966-35.966-35.966H374.022c-19.865 0-35.966 16.101-35.966 35.966 0 19.864 16.102 35.966 35.966 35.966M220.52 474.749c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966s35.966-16.107 35.966-35.966c0-19.864-16.102-35.966-35.966-35.966m0 215.796c-19.865 0-35.966 16.101-35.966 35.966 0 19.859 16.101 35.966 35.966 35.966s35.966-16.107 35.966-35.966c0-19.865-16.102-35.966-35.966-35.966" p-id="8691" fill="#2c2c2c"></path>
10
11
</svg >
11
12
</div >
12
- <div class =" setting" v-if =" isRenderSetting" >
13
- <label v-if =" showStart" >
14
- <span class =" name" >START INDEX:</span >
13
+ <div class =" setting" v-show =" showSetting" >
14
+ <div class =" option" v-if =" showStart" >
15
+ <span class =" name" v-if =" isMobile" >Index:</span >
16
+ <span class =" name" v-else >Start index:</span >
15
17
<input type =" text"
16
18
v-model =" selfStartIndex"
17
19
v-on:focus =" $event.target.select()"
18
20
v-on:input =" inputDataChange('start', $event.target.value)"
19
21
>
20
- </label >
21
- <i v-bind:style =" {visibility: hasTypingInput ? 'visible' : 'hidden'}" >updated after debounce 1s.</i >
22
+ </div >
23
+
24
+ <div class =" option" >
25
+ <span class =" name" v-if =" isMobile" >Count:</span >
26
+ <span class =" name" v-else >List count:</span >
27
+ <label >
28
+ <input type =" radio" value =" 1" v-model =" renderCount" >
29
+ <span class =" t1" >1,000</span >
30
+ </label >
31
+ <label class =" middle" >
32
+ <input type =" radio" value =" 2" v-model =" renderCount" >
33
+ <span class =" t2" >10,000</span >
34
+ </label >
35
+ <label >
36
+ <input type =" radio" value =" 3" v-model =" renderCount" >
37
+ <span class =" t3" >100,000</span >
38
+ </label >
39
+ </div >
22
40
</div >
23
41
</section >
24
42
</header >
25
43
</template >
26
44
27
45
<script >
28
- import { debounce } from ' ./util'
46
+ import { isMobile , debounce , getQuery , countStorage , settingStorage } from ' ./util'
29
47
30
48
export default {
31
49
name: ' app-header' ,
32
50
33
51
data () {
34
52
return {
35
- memoryUsed: 0 ,
36
- supportMemory: false ,
37
- showSetting: false ,
53
+ isMobile,
38
54
selfStartIndex: 0 ,
39
- hasTypingInput: false ,
55
+ showSetting: settingStorage .isShow (),
56
+ renderCount: String (countStorage .get ()).length - 3
40
57
}
41
58
},
42
59
@@ -50,6 +67,13 @@ export default {
50
67
}
51
68
},
52
69
70
+ watch: {
71
+ renderCount (val ) {
72
+ countStorage .set (val)
73
+ window .location .reload ()
74
+ }
75
+ },
76
+
53
77
props: {
54
78
warning: Boolean ,
55
79
title: String ,
@@ -60,25 +84,21 @@ export default {
60
84
61
85
methods: {
62
86
clickIcon () {
63
- this .showSetting = ! this .showSetting
87
+ const nextStatus = ! this .showSetting
88
+ this .showSetting = nextStatus
89
+ settingStorage .setShow (nextStatus)
64
90
},
65
91
66
92
inputDataChange: debounce (function (type , value ) {
67
93
const val = Number (value)
68
94
if (this .onDataChange && value !== ' ' && ! isNaN (val) && val >= 0 ) {
69
- this .hasTypingInput = true
70
95
this .onDataChange (type, val)
71
96
}
72
97
}, 1000 , false )
73
98
},
74
99
75
100
mounted () {
76
101
this .selfStartIndex = this .startIndex
77
-
78
- if (window .performance && window .performance .memory && window .performance .memory .usedJSHeapSize ) {
79
- this .supportMemory = true
80
- this .memoryUsed = parseInt (window .performance .memory .usedJSHeapSize / (1024 * 1024 ))
81
- }
82
102
}
83
103
}
84
104
</script >
@@ -100,17 +120,31 @@ header {
100
120
margin-bottom : 20px ;
101
121
border-radius : 5px ;
102
122
position : relative ;
103
- .memory {
123
+ .performance {
104
124
color : #ee82ee ;
105
125
position : absolute ;
106
126
right : 50px ;
127
+ font-size : 12px ;
128
+ @media (max-width : 640px ) {
129
+ display : block ;
130
+ position : relative ;
131
+ right : 0 ;
132
+ padding-top : 5px ;
133
+ }
134
+ }
135
+ .memory {
136
+ top : 18px ;
107
137
@media (max-width : 640px ) {
108
138
display : block ;
109
139
position : relative ;
110
140
right : 0 ;
111
141
padding-top : 5px ;
142
+ top : 0 ;
112
143
}
113
144
}
145
+ .time {
146
+ top : 5px ;
147
+ }
114
148
.icon {
115
149
width : 25px ;
116
150
height : 25px ;
@@ -128,7 +162,10 @@ header {
128
162
.setting {
129
163
position : relative ;
130
164
padding : 30px 0 20px 20px ;
131
- label {
165
+ @media (max-width : 640px ) {
166
+ padding : 20px 0 20px 0px ;
167
+ }
168
+ .option {
132
169
display : block ;
133
170
margin-bottom : 20px ;
134
171
& :last-child {
@@ -140,6 +177,29 @@ header {
140
177
display : inline-block ;
141
178
min-width : 120px ;
142
179
text-align : left ;
180
+ @media (max-width : 640px ) {
181
+ min-width : 50px ;
182
+ }
183
+ }
184
+ .middle {
185
+ margin : 0 20px ;
186
+ @media (max-width : 640px ) {
187
+ margin : 0 ;
188
+ }
189
+ }
190
+ label {
191
+ input {
192
+ @media (max-width : 640px ) {
193
+ position : relative ;
194
+ top : 3px ;
195
+ }
196
+ }
197
+ span {
198
+ @media (max-width : 640px ) {
199
+ position : relative ;
200
+ left : -5px ;
201
+ }
202
+ }
143
203
}
144
204
}
145
205
i {
@@ -148,7 +208,7 @@ header {
148
208
color : lightsteelblue ;
149
209
font-size : 12px ;
150
210
}
151
- input {
211
+ input [type = " text " ] {
152
212
-webkit-appearance : none ;
153
213
appearance : none ;
154
214
padding : 5px ;
@@ -168,8 +228,11 @@ header {
168
228
}
169
229
}
170
230
header .warning {
171
- h1 {
231
+ h1 , .desciption {
172
232
color : #ffc107 ;
173
233
}
234
+ .t3 {
235
+ color : red ;
236
+ }
174
237
}
175
238
</style >
0 commit comments