-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
756 lines (540 loc) · 41.7 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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AmazingBlog</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" href="https://blog.666baby.com/wp-content/uploads/2022/01/cropped-%E6%9C%AA%E6%A0%87%E9%A2%98-1-32x32.png">
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link rel="stylesheet" href="/css/style.css">
<meta name="generator" content="Hexo 6.2.0"></head>
<body>
<div id="container">
<div id="wrap">
<header id="header">
<div id="header-outer" class="outer">
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle"></a>
<a class="main-nav-link" href="/">首页</a>
<a class="main-nav-link" href="/archives">归档</a>
<a class="main-nav-link" href="/about">关于</a>
<a class="main-nav-link" href="/board">留言</a>
</nav>
<nav id="sub-nav">
</nav>
<div id="search-form-wrap">
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://example.com"></form>
</div>
</div>
</div>
</header>
<div class="outer">
<section id="main">
<article id="post-uniapp原生tabbar添加阴影" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/22/uniapp%E5%8E%9F%E7%94%9Ftabbar%E6%B7%BB%E5%8A%A0%E9%98%B4%E5%BD%B1/">uniapp原生tabBar添加阴影</a>
</h1>
<div class="article-meta">
<a href="/2022/07/22/uniapp%E5%8E%9F%E7%94%9Ftabbar%E6%B7%BB%E5%8A%A0%E9%98%B4%E5%BD%B1/" class="article-date">
<time datetime="2022-07-22T05:22:50.000Z" itemprop="datePublished">2022-07-22</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/">小技巧</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="方法"><a href="#方法" class="headerlink" title="方法"></a>方法</h2><p>使用uniapp原生的tabBar的时候,发现文档并没有提供设置阴影的api</p>
<p>原生渲染的tabBar在app端也不能使用CSS添加阴影</p>
<p>所以只能寻找一些其他的方法:</p>
<p>我们可以在文档中找到一个设置tabBar高斯模糊效果的选项,使用了这个选项可以使页面底部下沉到与tabbar重叠</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-29.png"></p>
<p>使用了模糊效果</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-28.png"></p>
<p>没有使用模糊效果</p>
<p>利用这个特性可以在tabBar下面再放一个div,让这个来产生阴影效果。</p>
<p>然后再给tabBar设置背景颜色使模糊效果失效。</p>
<p>先写一个这样的页面👇</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/b471e8fac3609aaaa44507fe3fb7d21.jpg"></p>
<p>然后把他放到首页</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/dd4afe48061418b3584b3b56647ca24.jpg"></p>
<p>设置背景颜色</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-30.png"></p>
<p>效果</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-31.png"></p>
<p>这样做唯一的问题是浪费了性能,开了模糊效果却隐藏了没有使用,但是都用uniapp了,肯定也不会在意性能问题了。</p>
<h2 id="完整代码"><a href="#完整代码" class="headerlink" title="完整代码"></a>完整代码</h2><p><code>shadow.vue</code></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><template></span><br><span class="line"> <cover-view class="shadow" :style="{ 'padding-bottom': paddingBottomHeight + 'rpx' }"></span><br><span class="line"> </cover-view></span><br><span class="line"></template></span><br><span class="line"></span><br><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"></span><br><span class="line"> data() {</span><br><span class="line"> return {</span><br><span class="line"> paddingBottomHeight: 0, //苹果X以上底部适配高度</span><br><span class="line"> };</span><br><span class="line"> },</span><br><span class="line">};</span><br><span class="line"></script></span><br><span class="line"></span><br><span class="line"><style lang="scss" scoped></span><br><span class="line">.shadow {</span><br><span class="line"> position: fixed;</span><br><span class="line"> bottom: 0;</span><br><span class="line"> left: 0;</span><br><span class="line"> right: 0;</span><br><span class="line"> display: flex;</span><br><span class="line"> justify-content: space-around;</span><br><span class="line"> align-items: center;</span><br><span class="line"> width: 100%;</span><br><span class="line"> height: 50px;</span><br><span class="line"> background-color: #ff2020;</span><br><span class="line"> box-shadow: 0px -12px 35px -2px rgb(0 0 0 / 22%);</span><br><span class="line">}</span><br><span class="line"></style></span><br></pre></td></tr></table></figure>
<h2 id="使用方法"><a href="#使用方法" class="headerlink" title="使用方法"></a>使用方法</h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><template></span><br><span class="line"> //添加组件</span><br><span class="line"> <Shadow></Shadow></span><br><span class="line"></template></span><br><span class="line"><script></span><br><span class="line">//引入组件</span><br><span class="line">import Shadow from '@/components/shadow.vue';</span><br><span class="line">//注册组件</span><br><span class="line">export default {</span><br><span class="line">components: {</span><br><span class="line"> Shadow</span><br><span class="line"> },</span><br><span class="line">}</span><br><span class="line"></script></span><br></pre></td></tr></table></figure>
<p>Photo by <a target="_blank" rel="noopener" href="https://unsplash.com/@jalil_sd?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Jalil Saeidi</a> on <a target="_blank" rel="noopener" href="https://unsplash.com/images?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a></p>
</div>
</div>
</article>
<article id="post-uniapp-nvue出现大量的样式文件报错问题" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/21/uniapp-nvue%E5%87%BA%E7%8E%B0%E5%A4%A7%E9%87%8F%E7%9A%84%E6%A0%B7%E5%BC%8F%E6%96%87%E4%BB%B6%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98/">Uniapp NVue出现大量的样式文件报错问题</a>
</h1>
<div class="article-meta">
<a href="/2022/07/21/uniapp-nvue%E5%87%BA%E7%8E%B0%E5%A4%A7%E9%87%8F%E7%9A%84%E6%A0%B7%E5%BC%8F%E6%96%87%E4%BB%B6%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98/" class="article-date">
<time datetime="2022-07-21T08:39:51.000Z" itemprop="datePublished">2022-07-21</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>在uniapp加入地图组建的时候需要用到marker的上的气泡 callout</p>
<p>然而使用marker的上的气泡callout又需要Nvue,于是创建了一个Nvue文件,编译的时候出现了大量的警告。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-24.png"></p>
<p>由于因为新添加了一个地图页面导致了大量的报错,所以一直再找地图的问题。</p>
<p>直到看到一个视频👇</p>
<p>视频中提到了一个全局样式问题,app.vue中的全局样式会应用到所有文件,所以nvue页面也不例外。</p>
<p><a target="_blank" rel="noopener" href="https://uniapp.dcloud.io/collocation/App.html#%E5%85%A8%E5%B1%80%E6%A0%B7%E5%BC%8F">uni-app 全局样式</a></p>
<p>因为App.vue中的全局样式不符合nvue的写法,所以会导致报错。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/6Q31C0FNAOOB3EQSGK.jpg"></p>
<p>解决方法:使用条件编译,让编译器忽略这部分代码</p>
<p><a target="_blank" rel="noopener" href="https://uniapp.dcloud.io/tutorial/platform.html#preprocessor">跨端兼容 uni-app官网 (dcloud.io)</a></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-25.png"></p>
<p>弄好之后还是不可以的话,考虑一下是不是组件库出问题了,</p>
<p>把我自己写的CSS样式弄成局部样式,组件库CSS条件编译,问题解决。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-26.png"></p>
</div>
</div>
</article>
<article id="post-uniapp-nvue出现大量的样式文件报错问题-1" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/21/uniapp-nvue%E5%87%BA%E7%8E%B0%E5%A4%A7%E9%87%8F%E7%9A%84%E6%A0%B7%E5%BC%8F%E6%96%87%E4%BB%B6%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98-1/">Uniapp NVue出现大量的样式文件报错问题</a>
</h1>
<div class="article-meta">
<a href="/2022/07/21/uniapp-nvue%E5%87%BA%E7%8E%B0%E5%A4%A7%E9%87%8F%E7%9A%84%E6%A0%B7%E5%BC%8F%E6%96%87%E4%BB%B6%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98-1/" class="article-date">
<time datetime="2022-07-21T08:39:51.000Z" itemprop="datePublished">2022-07-21</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>在uniapp加入地图组建的时候需要用到marker的上的气泡 callout</p>
<p>然而使用marker的上的气泡callout又需要Nvue,于是创建了一个Nvue文件,编译的时候出现了大量的警告。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-24.png"></p>
<p>由于因为新添加了一个地图页面导致了大量的报错,所以一直再找地图的问题。</p>
<p>直到看到一个视频👇</p>
<p>视频中提到了一个全局样式问题,app.vue中的全局样式会应用到所有文件,所以nvue页面也不例外。</p>
<p><a target="_blank" rel="noopener" href="https://uniapp.dcloud.io/collocation/App.html#%E5%85%A8%E5%B1%80%E6%A0%B7%E5%BC%8F">uni-app 全局样式</a></p>
<p>因为App.vue中的全局样式不符合nvue的写法,所以会导致报错。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/6Q31C0FNAOOB3EQSGK.jpg"></p>
<p>解决方法:使用条件编译,让编译器忽略这部分代码</p>
<p><a target="_blank" rel="noopener" href="https://uniapp.dcloud.io/tutorial/platform.html#preprocessor">跨端兼容 uni-app官网 (dcloud.io)</a></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-25.png"></p>
<p>弄好之后还是不可以的话,考虑一下是不是组件库出问题了,</p>
<p>把我自己写的CSS样式弄成局部样式,组件库CSS条件编译,问题解决。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-26.png"></p>
</div>
</div>
</article>
<article id="post-uniapp打包后hbuilder版本或cli版本与手机端sdk版本不一致" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/17/uniapp%E6%89%93%E5%8C%85%E5%90%8Ehbuilder%E7%89%88%E6%9C%AC%E6%88%96cli%E7%89%88%E6%9C%AC%E4%B8%8E%E6%89%8B%E6%9C%BA%E7%AB%AFsdk%E7%89%88%E6%9C%AC%E4%B8%8D%E4%B8%80%E8%87%B4/">uniapp打包后HBuilder版本或cli版本与手机端SDK版本不一致</a>
</h1>
<div class="article-meta">
<a href="/2022/07/17/uniapp%E6%89%93%E5%8C%85%E5%90%8Ehbuilder%E7%89%88%E6%9C%AC%E6%88%96cli%E7%89%88%E6%9C%AC%E4%B8%8E%E6%89%8B%E6%9C%BA%E7%AB%AFsdk%E7%89%88%E6%9C%AC%E4%B8%8D%E4%B8%80%E8%87%B4/" class="article-date">
<time datetime="2022-07-17T08:22:56.000Z" itemprop="datePublished">2022-07-17</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/">小技巧</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>一群垃圾,全他妈的抄来抄去的狗屎 👇</p>
<p>只会无脑抄官方的教程,<strong>还放出来污染搜索引擎</strong>。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-12.png"></p>
<p>运行的环境是 vite+uniapp</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-21.png"></p>
<p>然后用 <code>npm run build:app</code> 生成app打包文件,再用HbuilderX打开进行APP云打包,安装到手机上运行,就会出现这样版本不一致的错误。</p>
<p>但是用上面的方法创建了项目,会导致项目中的cli版本过高(3.5.2),然而HBuilderX的最高版本也才(3.5.1)这注定是一个报错的局。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-16.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/Snipaste_2022-07-17_15-44-13.png"></p>
<p>解决方法:</p>
<p>删掉node_moudles文件夹,去掉版本号前面的<code>^</code>,然后确认HBuliderX的版本是否与package.json中的版本是否一致。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-14.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-17.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-20.png"></p>
<p>全部去掉,重新<code>npm install</code>,重新打包运行。</p>
<p>这官方文档可真是不是一般的不详细👎👎👎👎👎👎</p>
</div>
</div>
</article>
<article id="post-uniapp打包后hbuilder版本或cli版本与手机端sdk版本不一致-1" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/17/uniapp%E6%89%93%E5%8C%85%E5%90%8Ehbuilder%E7%89%88%E6%9C%AC%E6%88%96cli%E7%89%88%E6%9C%AC%E4%B8%8E%E6%89%8B%E6%9C%BA%E7%AB%AFsdk%E7%89%88%E6%9C%AC%E4%B8%8D%E4%B8%80%E8%87%B4-1/">uniapp打包后HBuilder版本或cli版本与手机端SDK版本不一致</a>
</h1>
<div class="article-meta">
<a href="/2022/07/17/uniapp%E6%89%93%E5%8C%85%E5%90%8Ehbuilder%E7%89%88%E6%9C%AC%E6%88%96cli%E7%89%88%E6%9C%AC%E4%B8%8E%E6%89%8B%E6%9C%BA%E7%AB%AFsdk%E7%89%88%E6%9C%AC%E4%B8%8D%E4%B8%80%E8%87%B4-1/" class="article-date">
<time datetime="2022-07-17T08:22:56.000Z" itemprop="datePublished">2022-07-17</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/">小技巧</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>一群垃圾,全他妈的抄来抄去的狗屎 👇</p>
<p>只会无脑抄官方的教程,<strong>还放出来污染搜索引擎</strong>。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-12.png"></p>
<p>运行的环境是 vite+uniapp</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-21.png"></p>
<p>然后用 <code>npm run build:app</code> 生成app打包文件,再用HbuilderX打开进行APP云打包,安装到手机上运行,就会出现这样版本不一致的错误。</p>
<p>但是用上面的方法创建了项目,会导致项目中的cli版本过高(3.5.2),然而HBuilderX的最高版本也才(3.5.1)这注定是一个报错的局。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-16.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/Snipaste_2022-07-17_15-44-13.png"></p>
<p>解决方法:</p>
<p>删掉node_moudles文件夹,去掉版本号前面的<code>^</code>,然后确认HBuliderX的版本是否与package.json中的版本是否一致。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-14.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-17.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-20.png"></p>
<p>全部去掉,重新<code>npm install</code>,重新打包运行。</p>
<p>这官方文档可真是不是一般的不详细👎👎👎👎👎👎</p>
</div>
</div>
</article>
<article id="post-visual-studio-code-c-language" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/16/visual-studio-code-c-language/">Visual Studio Code 配置C语言环境</a>
</h1>
<div class="article-meta">
<a href="/2022/07/16/visual-studio-code-c-language/" class="article-date">
<time datetime="2022-07-16T08:06:23.000Z" itemprop="datePublished">2022-07-16</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="安装C-x2F-C-编译器"><a href="#安装C-x2F-C-编译器" class="headerlink" title="安装C/C++编译器"></a>安装C/C++编译器</h2><p>推荐下载网站<a target="_blank" rel="noopener" href="http://winlibs.com/">http://winlibs.com/</a></p>
<p>找一个最新版本下载并安装</p>
<p>如果下载慢的话,右键复制链接到迅雷下载,或者使用FDM等多线程下载软件。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/03/image-23.png"></p>
<p>建议下载Win64版本,7z或zip均可</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/03/image-24.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-14.png"></p>
<p>一定要全英文路径的目录(每一级文件夹都不要有中文)</p>
<p>例如 E:\mingw</p>
<h3 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h3><p>C语言需要先编译成一个可执行文件,然后才能运行,因为vscode仅是一个用来打代码的编辑器,不提供对代码的编译功能,需要手动安装编译器才能够正常使用,刚才上面下载的文件便是C/C++的编译器。</p>
<p>Dev C++或者是cfree安装之后即可使用,是因为它是一个IDE(Integrated Development Environment,集成式开发环境),集成了C语言的编译器,打开软件安装目录可以看到mingw文件夹,这个文件夹便里面存的是它的编译器。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-9.png"></p>
<p>其实我们也可以使用它的编译器,但是版本实在是太低了</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-10.png"></p>
<h2 id="设置环境变量"><a href="#设置环境变量" class="headerlink" title="设置环境变量"></a>设置环境变量</h2><p>解压完成之后,找到解压出来的文件,复制文件内bin</p>
<p>例如:E:\mingw64\bin</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-7.png"></p>
<p>然后 Windows 10/11 : 开始按钮右键——系统——高级系统设置——环境变量。</p>
<p>或者桌面 ”此电脑“ 图标右键——属性——高级系统设置——环境变量。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-2.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted.png"></p>
<p>记得把输入框中的双引号去掉,然后全部点击确定,然后测试环境变量</p>
<h2 id="在终端中测试环境变量:"><a href="#在终端中测试环境变量:" class="headerlink" title="在终端中测试环境变量:"></a>在终端中测试环境变量:</h2><p>“开始按钮右键打开PowerShell”</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-3.png"></p>
<p>win+R 运行 cmd 在终端中输入 <code>gcc -v</code> 会输出以上版本信息 ,表明配置成功</p>
<h2 id="在vscode中安装一个必需的扩展"><a href="#在vscode中安装一个必需的扩展" class="headerlink" title="在vscode中安装一个必需的扩展"></a><strong>在vscode中安装一个必需的扩展</strong></h2><p>以上几步是安装完成了编译器,现在要添加VScode对C语言的支持。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image.png"></p>
<p>安装完插件,找一个**<em>不包含中文路径的</em>**位置新建文件夹,然后拖到vscode里面</p>
<p>写一个C语言或者C++ helloworld文件,初始化环境。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/mstsc_0CxySHDVWV.gif"></p>
<p>如果弹出是否信任这个文件夹一定要点信任,因为这是你写的代码。</p>
<p>否则你写的程序会无法运行。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-17.png"></p>
<p>接着点击右上角的 ”设置“ 图标,提示选择调试配置,C++选择第一项,C语言选择第三项。</p>
<p>选择之后会弹出一堆配置文件,关掉即可,转到写的代码,然后按下F5即可运行</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-6.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/ApplicationFrameHost_uvS7QvWYWr.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/mstsc_COIfvMyKcp.gif"></p>
<p><strong>动图演示</strong></p>
<p>配置完成!</p>
<h2 id="弹出黑框框运行程序"><a href="#弹出黑框框运行程序" class="headerlink" title="弹出黑框框运行程序"></a>弹出黑框框运行程序</h2><p><strong>不推荐这种方式,极其不方便。</strong></p>
<p>如果程序一闪而过,那么就在程序最后一行加上<code>system("pause");</code></p>
<p>注意不要加到 <code>return 0;</code> 后面。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-8.png"></p>
<h2 id="debug-打断点"><a href="#debug-打断点" class="headerlink" title="debug 打断点"></a>debug 打断点</h2><p>需要打开一个工作区(文件夹),因为debug的配置文件存在一个工作区当中。</p>
<p>程序路径不要有中文,否则会报错</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/mstsc_hGzI3VngUH.gif"></p>
<p><code>F5</code>默认是debug模式,打完断点之后直接<code>F5</code>即可,也可以选择右上角的选项。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-9.png"></p>
<p>开始调试之后内容会在终端输出:</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-10.png"></p>
<blockquote>
<p>参考:</p>
<p><a target="_blank" rel="noopener" href="https://code.visualstudio.com/docs/cpp/config-mingw">Get Started with C++ and Mingw-w64 in Visual Studio Code</a></p>
</blockquote>
</div>
</div>
</article>
<article id="post-visual-studio-code-c-language-1" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/16/visual-studio-code-c-language-1/">Visual Studio Code 配置C语言环境</a>
</h1>
<div class="article-meta">
<a href="/2022/07/16/visual-studio-code-c-language-1/" class="article-date">
<time datetime="2022-07-16T08:06:23.000Z" itemprop="datePublished">2022-07-16</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<h2 id="安装C-x2F-C-编译器"><a href="#安装C-x2F-C-编译器" class="headerlink" title="安装C/C++编译器"></a>安装C/C++编译器</h2><p>推荐下载网站<a target="_blank" rel="noopener" href="http://winlibs.com/">http://winlibs.com/</a></p>
<p>找一个最新版本下载并安装</p>
<p>如果下载慢的话,右键复制链接到迅雷下载,或者使用FDM等多线程下载软件。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/03/image-23.png"></p>
<p>建议下载Win64版本,7z或zip均可</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/03/image-24.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-14.png"></p>
<p>一定要全英文路径的目录(每一级文件夹都不要有中文)</p>
<p>例如 E:\mingw</p>
<h3 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h3><p>C语言需要先编译成一个可执行文件,然后才能运行,因为vscode仅是一个用来打代码的编辑器,不提供对代码的编译功能,需要手动安装编译器才能够正常使用,刚才上面下载的文件便是C/C++的编译器。</p>
<p>Dev C++或者是cfree安装之后即可使用,是因为它是一个IDE(Integrated Development Environment,集成式开发环境),集成了C语言的编译器,打开软件安装目录可以看到mingw文件夹,这个文件夹便里面存的是它的编译器。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-9.png"></p>
<p>其实我们也可以使用它的编译器,但是版本实在是太低了</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-10.png"></p>
<h2 id="设置环境变量"><a href="#设置环境变量" class="headerlink" title="设置环境变量"></a>设置环境变量</h2><p>解压完成之后,找到解压出来的文件,复制文件内bin</p>
<p>例如:E:\mingw64\bin</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-7.png"></p>
<p>然后 Windows 10/11 : 开始按钮右键——系统——高级系统设置——环境变量。</p>
<p>或者桌面 ”此电脑“ 图标右键——属性——高级系统设置——环境变量。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-2.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted.png"></p>
<p>记得把输入框中的双引号去掉,然后全部点击确定,然后测试环境变量</p>
<h2 id="在终端中测试环境变量:"><a href="#在终端中测试环境变量:" class="headerlink" title="在终端中测试环境变量:"></a>在终端中测试环境变量:</h2><p>“开始按钮右键打开PowerShell”</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-3.png"></p>
<p>win+R 运行 cmd 在终端中输入 <code>gcc -v</code> 会输出以上版本信息 ,表明配置成功</p>
<h2 id="在vscode中安装一个必需的扩展"><a href="#在vscode中安装一个必需的扩展" class="headerlink" title="在vscode中安装一个必需的扩展"></a><strong>在vscode中安装一个必需的扩展</strong></h2><p>以上几步是安装完成了编译器,现在要添加VScode对C语言的支持。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image.png"></p>
<p>安装完插件,找一个**<em>不包含中文路径的</em>**位置新建文件夹,然后拖到vscode里面</p>
<p>写一个C语言或者C++ helloworld文件,初始化环境。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/mstsc_0CxySHDVWV.gif"></p>
<p>如果弹出是否信任这个文件夹一定要点信任,因为这是你写的代码。</p>
<p>否则你写的程序会无法运行。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2021/04/Pasted-17.png"></p>
<p>接着点击右上角的 ”设置“ 图标,提示选择调试配置,C++选择第一项,C语言选择第三项。</p>
<p>选择之后会弹出一堆配置文件,关掉即可,转到写的代码,然后按下F5即可运行</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-6.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/ApplicationFrameHost_uvS7QvWYWr.png"></p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/mstsc_COIfvMyKcp.gif"></p>
<p><strong>动图演示</strong></p>
<p>配置完成!</p>
<h2 id="弹出黑框框运行程序"><a href="#弹出黑框框运行程序" class="headerlink" title="弹出黑框框运行程序"></a>弹出黑框框运行程序</h2><p><strong>不推荐这种方式,极其不方便。</strong></p>
<p>如果程序一闪而过,那么就在程序最后一行加上<code>system("pause");</code></p>
<p>注意不要加到 <code>return 0;</code> 后面。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-8.png"></p>
<h2 id="debug-打断点"><a href="#debug-打断点" class="headerlink" title="debug 打断点"></a>debug 打断点</h2><p>需要打开一个工作区(文件夹),因为debug的配置文件存在一个工作区当中。</p>
<p>程序路径不要有中文,否则会报错</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/mstsc_hGzI3VngUH.gif"></p>
<p><code>F5</code>默认是debug模式,打完断点之后直接<code>F5</code>即可,也可以选择右上角的选项。</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-9.png"></p>
<p>开始调试之后内容会在终端输出:</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/image-10.png"></p>
<blockquote>
<p>参考:</p>
<p><a target="_blank" rel="noopener" href="https://code.visualstudio.com/docs/cpp/config-mingw">Get Started with C++ and Mingw-w64 in Visual Studio Code</a></p>
</blockquote>
</div>
</div>
</article>
<article id="post-小米10umi-开发版救砖过程记录" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/08/%E5%B0%8F%E7%B1%B310umi-%E5%BC%80%E5%8F%91%E7%89%88%E6%95%91%E7%A0%96%E8%BF%87%E7%A8%8B%E8%AE%B0%E5%BD%95/">小米10(umi)-开发版救砖过程记录</a>
</h1>
<div class="article-meta">
<a href="/2022/07/08/%E5%B0%8F%E7%B1%B310umi-%E5%BC%80%E5%8F%91%E7%89%88%E6%95%91%E7%A0%96%E8%BF%87%E7%A8%8B%E8%AE%B0%E5%BD%95/" class="article-date">
<time datetime="2022-07-08T06:50:02.000Z" itemprop="datePublished">2022-07-08</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>开发板内测版本:22.7.7</p>
<p>升级到7.7版本之后出现了开机闪屏,原因未知。</p>
<p>解决方法只有一个,重新安装当前版本的安装包</p>
<p>最近由于小米越来越流氓的政策,无法下载开发板内测的刷机包,只能去第三方网站下载。</p>
<p><a target="_blank" rel="noopener" href="https://miuiver.com/">MIUI历史版本 – 各机型MIUI旧版本下载索引 (miuiver.com)</a></p>
<p>在这个网站上👆找到需要的miui版本</p>
<p>官方REC也基本上废了,去欧洲版社区找一个比较新的twrp,需要支持安卓12。</p>
<p><a target="_blank" rel="noopener" href="https://xiaomi.eu/community/threads/twrp-for-android-12-mi-10-and-other-models.64186/">TWRP for Android 12 (MI 10, and other models ) Xiaomi European Community MIUI ROM Since 2010</a></p>
<p>然后刷入REC:</p>
<p>刷入REC:<code>fastboot flash recovery .\twrp-3.6.2_12-v3.7_A12-umi-skkk.img</code></p>
<p>启动REC:<code>fastboot boot .\twrp-3.6.2_12-v3.7_A12-umi-skkk.img</code></p>
<p>启动之后在设置里面打开miui更新支持</p>
<p>然后进入adb sideload模式(不需要清除数据)</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/0fafbfd5807bf2221bb83933a07a74e.png"></p>
<p>刷机完成之后重启,成不成看运气。</p>
</div>
</div>
</article>
<article id="post-小米10umi-开发版救砖过程记录-1" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/07/08/%E5%B0%8F%E7%B1%B310umi-%E5%BC%80%E5%8F%91%E7%89%88%E6%95%91%E7%A0%96%E8%BF%87%E7%A8%8B%E8%AE%B0%E5%BD%95-1/">小米10(umi)-开发版救砖过程记录</a>
</h1>
<div class="article-meta">
<a href="/2022/07/08/%E5%B0%8F%E7%B1%B310umi-%E5%BC%80%E5%8F%91%E7%89%88%E6%95%91%E7%A0%96%E8%BF%87%E7%A8%8B%E8%AE%B0%E5%BD%95-1/" class="article-date">
<time datetime="2022-07-08T06:50:02.000Z" itemprop="datePublished">2022-07-08</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p>开发板内测版本:22.7.7</p>
<p>升级到7.7版本之后出现了开机闪屏,原因未知。</p>
<p>解决方法只有一个,重新安装当前版本的安装包</p>
<p>最近由于小米越来越流氓的政策,无法下载开发板内测的刷机包,只能去第三方网站下载。</p>
<p><a target="_blank" rel="noopener" href="https://miuiver.com/">MIUI历史版本 – 各机型MIUI旧版本下载索引 (miuiver.com)</a></p>
<p>在这个网站上👆找到需要的miui版本</p>
<p>官方REC也基本上废了,去欧洲版社区找一个比较新的twrp,需要支持安卓12。</p>
<p><a target="_blank" rel="noopener" href="https://xiaomi.eu/community/threads/twrp-for-android-12-mi-10-and-other-models.64186/">TWRP for Android 12 (MI 10, and other models ) Xiaomi European Community MIUI ROM Since 2010</a></p>
<p>然后刷入REC:</p>
<p>刷入REC:<code>fastboot flash recovery .\twrp-3.6.2_12-v3.7_A12-umi-skkk.img</code></p>
<p>启动REC:<code>fastboot boot .\twrp-3.6.2_12-v3.7_A12-umi-skkk.img</code></p>
<p>启动之后在设置里面打开miui更新支持</p>
<p>然后进入adb sideload模式(不需要清除数据)</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/07/0fafbfd5807bf2221bb83933a07a74e.png"></p>
<p>刷机完成之后重启,成不成看运气。</p>
</div>
</div>
</article>
<article id="post-failed-to-connect-to-192-168-21-9040179" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-inner">
<header class="article-header">
<h1 itemprop="name">
<a class="p-name article-title" href="/2022/06/26/failed-to-connect-to-192-168-21-9040179/">failed to connect to 192.168.21.90:40179</a>
</h1>
<div class="article-meta">
<a href="/2022/06/26/failed-to-connect-to-192-168-21-9040179/" class="article-date">
<time datetime="2022-06-26T06:58:17.000Z" itemprop="datePublished">2022-06-26</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a>
</div>
</div>
</header>
<div class="article-entry" itemprop="articleBody">
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/06/image.png"></p>
<p>adb连接失败</p>
<p>插上线,连接adb,信任以下设备,在网络连接即可</p>
<p><img src="https://blog.666baby.com/wp-content/uploads/2022/06/Screenshot_2022-06-26-14-55-55-651_com.android.sy_.jpg"></p>
</div>
</div>
</article>
<nav id="page-nav">
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="page-number" href="/page/3/">3</a><span class="space">…</span><a class="page-number" href="/page/13/">13</a><a class="extend next" rel="next" href="/page/2/">next</a>
</nav>
</section>
<aside id="sidebar">
<div class="widget-wrap">
<div class="widget-wrap-info">
<img src="https://blog.666baby.com/wp-content/uploads/2021/12/Pasted-2.png" class="widget-wrap-info-img">
<div class="widget-wrap-info-author">吴晗</div>
<div class="widget-wrap-info-signature">业精于勤,荒于嬉。</div>
</div>
<div class="info-nav">
<ul class="info-nav-ul">
<li class="info-nav-li">
<a class="info-nav-link" href="/">
<div class="info-nav-div">
<span class="info-nav-icon">
<i data-feather="home"></i>
</span>
<span class="info-nav-name">首页</span>
</div>
</a>
</li>
<li class="info-nav-li">
<a class="info-nav-link" href="/archives">
<div class="info-nav-div">
<span class="info-nav-icon">
<i data-feather="archive"></i>
</span>
<span class="info-nav-name">归档</span>
</div>
</a>
</li>
<li class="info-nav-li">
<a class="info-nav-link" href="/about">
<div class="info-nav-div">
<span class="info-nav-icon">
<i data-feather="alert-circle"></i>
</span>
<span class="info-nav-name">关于</span>
</div>
</a>
</li>
<li class="info-nav-li">
<a class="info-nav-link" href="/board">
<div class="info-nav-div">
<span class="info-nav-icon">
<i data-feather="edit-3"></i>
</span>
<span class="info-nav-name">留言</span>
</div>
</a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info" class="inner">
© 2022 吴晗<br>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a> | Theme by <a href="https://github.com/FuShaoLei/hexo-theme-hiya" target="_blank">Hiya</a>
<br>
<span id="busuanzi_container_site_pv">总访问量<span id="busuanzi_value_site_pv"></span>次</span>
<span id="busuanzi_container_site_uv">
访客数<span id="busuanzi_value_site_uv"></span>人次
</span>
</div>
</div>
</footer>
</div>
<nav id="mobile-nav">
<a href="/,home" class="mobile-nav-link">首页</a>
<a href="/archives,archive" class="mobile-nav-link">归档</a>
<a href="/about,alert-circle" class="mobile-nav-link">关于</a>
<a href="/board,edit-3" class="mobile-nav-link">留言</a>
</nav>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js"></script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script>
feather.replace()
</script>
<script src="/js/script.js"></script>
</div>
</body>
</html>