-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
625 lines (441 loc) · 35.8 KB
/
atom.xml
File metadata and controls
625 lines (441 loc) · 35.8 KB
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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Deepspace</title>
<subtitle>我叫陈星星</subtitle>
<link href="/atom.xml" rel="self"/>
<link href="https://togoblog.cn/"/>
<updated>2019-11-07T09:31:58.255Z</updated>
<id>https://togoblog.cn/</id>
<author>
<name>Deepspace</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>Web 前端工程化(三) —— 使用 Jenkins + Github 搭建持续集成环境</title>
<link href="https://togoblog.cn/set-up-ci-env-with-jenkins-and-github/"/>
<id>https://togoblog.cn/set-up-ci-env-with-jenkins-and-github/</id>
<published>2019-11-06T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.255Z</updated>
<summary type="html">
</summary>
<category term="FrontEnd" scheme="https://togoblog.cn/categories/FrontEnd/"/>
<category term="持续集成" scheme="https://togoblog.cn/tags/%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90/"/>
<category term="Jenkins" scheme="https://togoblog.cn/tags/Jenkins/"/>
<category term="Github" scheme="https://togoblog.cn/tags/Github/"/>
</entry>
<entry>
<title>Web 前端工程化(二) —— CI/CD</title>
<link href="https://togoblog.cn/what-is-ci-cd/"/>
<id>https://togoblog.cn/what-is-ci-cd/</id>
<published>2019-11-04T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.254Z</updated>
<summary type="html">
<p>工厂里的装配线以快速、自动化、可重复的方式从原材料生产出消费品。在软件开发领域,我们也同样会思考同样的问题:<strong>以快速、自动化和可重复的方式从源代码生成发布版本。</strong> </p>
<p><code>CI/CD</code> 是一种通过在应用开发阶段引入自动化来频繁向客户交付应用的方法。<code>CI/CD</code> 的核心概念是持续集成、持续交付和持续部署。</p>
<p>缩略词 <code>CI/CD</code> 具有几个不同的含义。<code>CI/CD</code> 中的 <code>CI</code> 指持续集成(<code>Continuous Integration</code>),<code>CI/CD</code> 中的 <code>CD</code> 指的是持续交付(<code>Continuous Delivery</code>)或持续部署(<code>Continuous Deployment</code>)。</p>
</summary>
<category term="FrontEnd" scheme="https://togoblog.cn/categories/FrontEnd/"/>
<category term="持续集成" scheme="https://togoblog.cn/tags/%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90/"/>
<category term="持续交付" scheme="https://togoblog.cn/tags/%E6%8C%81%E7%BB%AD%E4%BA%A4%E4%BB%98/"/>
<category term="持续部署" scheme="https://togoblog.cn/tags/%E6%8C%81%E7%BB%AD%E9%83%A8%E7%BD%B2/"/>
</entry>
<entry>
<title>Web 前端工程化(一) —— 什么是前后端分离?</title>
<link href="https://togoblog.cn/what-is-frontend-backend-separation/"/>
<id>https://togoblog.cn/what-is-frontend-backend-separation/</id>
<published>2019-10-30T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.254Z</updated>
<summary type="html">
<h3 id="一、什么是-Web-开发?"><a href="#一、什么是-Web-开发?" class="headerlink" title="一、什么是 Web 开发?"></a>一、什么是 Web 开发?</h3><p>如果在一个比较高的抽象层面来看待这个问题的话,<strong><code>Web</code> 开发就是在处理客户端请求及服务端响应这两件事</strong>。</p>
<p><img src="https://github.com/IDeepspace/ImageHosting/raw/master/FrontEnd/web-development.jpg" alt="Web 开发"></p>
<p>当然,这是抽象。在实际的 <code>Web</code> 开发中,我们会有很多东西需要关注。</p>
</summary>
<category term="FrontEnd" scheme="https://togoblog.cn/categories/FrontEnd/"/>
<category term="Web 前端工程化" scheme="https://togoblog.cn/tags/Web-%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/"/>
<category term="前后端分离" scheme="https://togoblog.cn/tags/%E5%89%8D%E5%90%8E%E7%AB%AF%E5%88%86%E7%A6%BB/"/>
</entry>
<entry>
<title>JavaScript 异步处理(ES6)</title>
<link href="https://togoblog.cn/javascript-async/"/>
<id>https://togoblog.cn/javascript-async/</id>
<published>2019-10-28T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.258Z</updated>
<summary type="html">
<h3 id="一、Promise-是什么?"><a href="#一、Promise-是什么?" class="headerlink" title="一、Promise 是什么?"></a>一、Promise 是什么?</h3><p>不是讲 <code>async/await</code> 吗?为什么会提到 <code>Promise</code> ?</p>
<p>实际上,<code>async/await</code> 是 <code>Promise</code> 的一个拓展,所以,想要更好地理解 <code>async/await</code>,需要先理解 <code>Promise</code> 。</p>
<p>我们先看看 <code>Promise</code> 是什么。先在浏览器中使用 <code>console.dir(Promise)</code> 打印出 <code>Promise</code> 对象的所的属性和方法:</p>
<p><img src="https://raw.githubusercontent.com/IDeepspace/ImageHosting/master/JavaScript/promise.png" alt="Promise"></p>
<p>从打印结果可以看出,<code>Promise</code> 是一个构造函数,它自己本身有 <code>all</code>、<code>reject</code>、<code>resolve</code> 等方法,原型上有 <code>catch</code>、<code>finally</code>、<code>then</code> 等方法。所以 <code>new</code> 出来的 <code>Promise</code> 对象也就自然拥有 <code>catch</code>、<code>finally</code>、<code>then</code> 这些方法。从上图中可以看到,<code>then</code> 方法返回的是一个新的 <code>Promise</code> 实例(注意,不是原来那个 <code>Promise</code> 实例)。因此可以采用链式写法,即 <code>then</code> 方法后面再调用另一个 <code>then</code> 方法。</p>
<p><code>Promise</code> 的中文意思是承诺,这种<strong>“承诺将来会执行”</strong>的对象在 <code>JavaScript</code> 中称为 <code>Promise</code> 对象。简单说就是一个容器,里面保存着某个未来才会执行的事件(通常是一个异步操作)的结果。<br>
</summary>
<category term="JavaScript" scheme="https://togoblog.cn/categories/JavaScript/"/>
<category term="异步" scheme="https://togoblog.cn/tags/%E5%BC%82%E6%AD%A5/"/>
</entry>
<entry>
<title>在 forEach 中使用 async/await 遇到的问题</title>
<link href="https://togoblog.cn/javascript-async-await-in-foreach/"/>
<id>https://togoblog.cn/javascript-async-await-in-foreach/</id>
<published>2019-10-24T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.259Z</updated>
<summary type="html">
<h3 id="一、问题描述"><a href="#一、问题描述" class="headerlink" title="一、问题描述"></a>一、问题描述</h3><p>前几天,项目中遇到一个 <code>JavaScript</code> 异步问题:</p>
<blockquote>
<p>有一组数据,需要对每一个数据进行一个异步处理,并且希望处理的时候是同步的。</p>
</blockquote>
<p>用代码描述如下:</p>
<pre><code class="javascript">// 生成数据
const getNumbers = () =&gt; {
return Promise.resolve([1, 2, 3])
}
// 异步处理
const doMulti = num =&gt; {
return new Promise((resolve, reject) =&gt; {
setTimeout(() =&gt; {
if (num) {
resolve(num * num)
} else {
reject(new Error(&#39;num not specified&#39;))
}
}, 2000)
})
}
// 主函数
const main = async () =&gt; {
console.log(&#39;start&#39;);
const nums = [1, 2, 3];
nums.forEach(async (x) =&gt; {
const res = await doMulti(x);
console.log(res);
});
console.log(&#39;end&#39;);
};
// 执行
main();
</code></pre>
</summary>
<category term="JavaScript" scheme="https://togoblog.cn/categories/JavaScript/"/>
<category term="async/await" scheme="https://togoblog.cn/tags/async-await/"/>
</entry>
<entry>
<title>EventEmitter</title>
<link href="https://togoblog.cn/eventemitter/"/>
<id>https://togoblog.cn/eventemitter/</id>
<published>2019-08-19T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.259Z</updated>
<summary type="html">
<p><code>Node.js</code> 所有的异步 <code>I/O</code> 操作在完成时都会发送一个事件到事件队列。</p>
<p>例如,<a href="http://nodejs.cn/s/gBYjux" target="_blank" rel="noopener"><code>net.Server</code></a> 会在每次有新连接时触发事件,<a href="http://nodejs.cn/s/C3Eioq" target="_blank" rel="noopener"><code>fs.ReadStream</code></a> 会在打开文件时触发事件,<a href="http://nodejs.cn/s/kUvpNm" target="_blank" rel="noopener"><code>stream</code></a> 会在数据可读时触发事件。</p>
<p>所有能触发事件的对象都是 <code>EventEmitter</code> 类的实例。 </p>
<h3 id="一、EventEmitter-类"><a href="#一、EventEmitter-类" class="headerlink" title="一、EventEmitter 类"></a>一、EventEmitter 类</h3><p><code>events</code> 模块只提供了一个对象: <code>events.EventEmitter</code>。<code>EventEmitter</code> 的核心就是事件触发与事件监听器功能的封装。</p>
<p>我们可以通过 <code>require(&#39;events&#39;);</code> 来访问该模块:</p>
<pre><code class="javascript">// 引入 events 模块
const Event = require(&#39;events&#39;);
// 创建 eventEmitter 对象
const eventEmitter = new Event.EventEmitter();
</code></pre>
</summary>
<category term="NodeJS" scheme="https://togoblog.cn/categories/NodeJS/"/>
<category term="EventEmitter" scheme="https://togoblog.cn/tags/EventEmitter/"/>
</entry>
<entry>
<title>React setState 的异步与同步</title>
<link href="https://togoblog.cn/react-setstate/"/>
<id>https://togoblog.cn/react-setstate/</id>
<published>2019-08-18T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.261Z</updated>
<summary type="html">
<h3 id="一、如何使用-setState"><a href="#一、如何使用-setState" class="headerlink" title="一、如何使用 setState"></a>一、如何使用 setState</h3><p>在 <code>React</code> 中,一个很重要的点就是不要直接去修改 <code>state</code>,类似于这样的写法:<code>this.state.count = 1</code> ,这种方式是无法触发 <code>React</code> 去更新视图的。因为 React 的机制中规定了:一个 <code>state</code> 的更新,首先需要调用 <code>setState</code> 方法:</p>
<pre><code class="jsx">this.setState({
count: 1
})
</code></pre>
<p>稍有经验的 <code>React</code> 开发者都会知道,<code>setState</code> 方法其实是<strong>异步</strong>的。即 <code>setState</code> 立马执行之后,是无法直接获取到最新的 <code>state</code> 的,需要经过 <code>React</code> 对 <code>state</code> 的所有改变进行合并处理之后,才会去计算新的虚拟 <code>DOM</code>,然后再根据最新的虚拟 <code>DOM</code> 去重新渲染真实 <code>DOM</code>。<br>
</summary>
<category term="React" scheme="https://togoblog.cn/categories/React/"/>
<category term="React" scheme="https://togoblog.cn/tags/React/"/>
</entry>
<entry>
<title>Oracle批量插入数据时ID自增问题</title>
<link href="https://togoblog.cn/oracle-id-increase/"/>
<id>https://togoblog.cn/oracle-id-increase/</id>
<published>2019-07-28T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.253Z</updated>
<summary type="html">
<!-- ## Oracle批量插入数据时ID自增问题 -->
<p><strong>三步走:</strong></p>
<p>1、创建序列 sequence</p>
<pre><code class="sql">create sequence seq_stu
increment by 1 -- 每次递增1
start with 1 -- 从1开始
nomaxvalue -- 没有最大值
minvalue 1 -- 最小值=1
NOCYCLE; -- 不循环
</code></pre>
<p>2、为序列创建触发事件</p>
<pre><code class="sql">create or replace trigger student_id_automation
before insert
on student
for each row
begin
IF :new.id IS NULL THEN :new.id := seq_stu.nextval;
end if;
end;
</code></pre>
</summary>
<category term="DataBase" scheme="https://togoblog.cn/categories/DataBase/"/>
<category term="Oracle" scheme="https://togoblog.cn/tags/Oracle/"/>
</entry>
<entry>
<title>微前端</title>
<link href="https://togoblog.cn/micro-frontends/"/>
<id>https://togoblog.cn/micro-frontends/</id>
<published>2019-06-23T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.255Z</updated>
<summary type="html">
<h3 id="一、什么是微前端?"><a href="#一、什么是微前端?" class="headerlink" title="一、什么是微前端?"></a>一、什么是微前端?</h3><p>微前端的概念由我司(<code>ThoughtWorks</code>)在2016年十一月份的<a href="https://www.thoughtworks.com/radar/techniques/micro-frontends" target="_blank" rel="noopener">技术雷达</a>中被列为组织应评估的技术,后来又被提升为试用版,最后将其推广到 <code>Adopt</code> 中。</p>
<p>微前端是一种类似于微服务的架构。它将微服务的理念应用于浏览器端,即将单页面前端应用由单一的单体应用转变为把多个小型前端应用聚合为一的应用。各个前端应用还可以独立开发,独立部署,这样我们也就实现了应用的自治。而划分的团队之间也可以自治,独立定义自己的命名规则、代码规范、技术栈、开发流程等。</p>
</summary>
<category term="FrontEnd" scheme="https://togoblog.cn/categories/FrontEnd/"/>
<category term="微前端" scheme="https://togoblog.cn/tags/%E5%BE%AE%E5%89%8D%E7%AB%AF/"/>
</entry>
<entry>
<title>Node.JS 中的事件循环机制</title>
<link href="https://togoblog.cn/event-loop-in-nodejs/"/>
<id>https://togoblog.cn/event-loop-in-nodejs/</id>
<published>2019-05-28T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.260Z</updated>
<summary type="html">
<h3 id="一、与浏览器中事件循环机制的差异"><a href="#一、与浏览器中事件循环机制的差异" class="headerlink" title="一、与浏览器中事件循环机制的差异"></a>一、与浏览器中事件循环机制的差异</h3><p>前面我们对浏览器中的事件循环机制有了一些了解,那 <code>Node</code> 环境下事件循环机制是否也是一致的呢?看段代码:</p>
<pre><code class="javascript">setTimeout(() =&gt; {
console.log(&#39;timer1&#39;)
Promise.resolve().then(function () {
console.log(&#39;promise1&#39;)
})
}, 0)
setTimeout(() =&gt; {
console.log(&#39;timer2&#39;)
Promise.resolve().then(function () {
console.log(&#39;promise2&#39;)
})
}, 0)
</code></pre>
</summary>
<category term="NodeJS" scheme="https://togoblog.cn/categories/NodeJS/"/>
<category term="事件循环" scheme="https://togoblog.cn/tags/%E4%BA%8B%E4%BB%B6%E5%BE%AA%E7%8E%AF/"/>
</entry>
<entry>
<title>浏览器中的事件循环机制</title>
<link href="https://togoblog.cn/event-loop-in-browser/"/>
<id>https://togoblog.cn/event-loop-in-browser/</id>
<published>2019-05-27T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.260Z</updated>
<summary type="html">
<blockquote>
<p>在看 Event loop 的时候,我发现相关的文章有很多,但是有的文章写得零碎,有的文章只讲解了浏览器或者 Node 环境之一的事件循环,这两者如果没有对比起来理解的话,总是觉得比较模糊。所以在读了很多文章之后,整理出来本文,本篇文章为《浏览器中的事件循环》,下一篇为《<a href="https://togoblog.cn/event-loop-in-nodejs/">Node.JS中的事件循环</a>》,二者对比起来理解会更好。</p>
</blockquote>
<h3 id="一、单线程和异步"><a href="#一、单线程和异步" class="headerlink" title="一、单线程和异步"></a>一、单线程和异步</h3><p>提到 <code>JavaScript</code> ,就会想到它的 <strong>单线程</strong> 和 <strong>异步</strong> 两大特性。那么在 <code>JavaScript</code> 中单线程是如何做到异步的呢?我们先了解一下单线程和异步之间的关系。</p>
<p><code>JavaScript</code> 中的任务分为 <strong>同步</strong> 和 <strong>异步</strong> 两种,它们的处理方式存在很大的不同。</p>
<h4 id="1、异步"><a href="#1、异步" class="headerlink" title="1、异步"></a>1、异步</h4><p><strong>同步任务</strong> 是直接在 <strong>主线程</strong> 上排队执行。在主线程上排队执行的任务,只有前一个任务执行完毕,才能执行后一个任务。所有同步任务都在主线程上执行,形成一个 <strong>执行栈</strong>(<code>execution context stack</code>)。</p>
<p><strong>异步任务</strong> 则是被放在 <strong>任务队列</strong> (<code>task queue</code>) 中,不进入主线程,只有 <strong>任务队列</strong> 通知主线程,某个异步任务可以执行了,该任务才会进入主线程执行。任务队列类似一个缓冲区,任务下一步会被移到 <strong>执行栈</strong>,然后主线程执行 <strong>执行栈 </strong>的任务。如果有多个异步任务,那这些异步任务就要在任务队列中排队等候。</p>
</summary>
<category term="NodeJS" scheme="https://togoblog.cn/categories/NodeJS/"/>
<category term="事件循环" scheme="https://togoblog.cn/tags/%E4%BA%8B%E4%BB%B6%E5%BE%AA%E7%8E%AF/"/>
</entry>
<entry>
<title>linux — 让 scp 始终覆盖或创建目录</title>
<link href="https://togoblog.cn/linux-scp-cover-completely/"/>
<id>https://togoblog.cn/linux-scp-cover-completely/</id>
<published>2019-05-19T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.259Z</updated>
<summary type="html">
<p>前段时间在搭建前端项目的基础设施时,遇到这样一个问题:在 <code>pipline</code> 上将前端项目 <code>build</code> 之后的文件夹拷贝到 <code>aws</code> 上,我使用 <code>scp</code> 命令将目录从一个远程服务器复制到另一个远程服务器上的新目录,命令如下:</p>
<pre><code class="shell">$ scp -r server1:dir1 server2:dir2
</code></pre>
<p>如果在 <code>server2</code> 上不存在 <code>dir2</code>,这可以正常工作,它会创建一个名为 <code>dir2</code> 的新目录,其中包含 <code>server1</code> 上 <code>dir1</code> 的所有内容。</p>
<p>但是当 <code>dir2</code> 已经存在于 <code>server2</code> 上时,就会出现问题,已经存在的文件不会被覆盖。<br>
</summary>
<category term="Linux" scheme="https://togoblog.cn/categories/Linux/"/>
<category term="Linux" scheme="https://togoblog.cn/tags/Linux/"/>
</entry>
<entry>
<title>Python 基础语法</title>
<link href="https://togoblog.cn/python-basic/"/>
<id>https://togoblog.cn/python-basic/</id>
<published>2019-05-11T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.260Z</updated>
<summary type="html">
<h3 id="一、标准数据类型"><a href="#一、标准数据类型" class="headerlink" title="一、标准数据类型"></a>一、标准数据类型</h3><h4 id="1、六个标准的数据类型:"><a href="#1、六个标准的数据类型:" class="headerlink" title="1、六个标准的数据类型:"></a>1、六个标准的数据类型:</h4><ul>
<li><p>Number(数字)</p>
<blockquote>
<p>支持三种不同的数值类型:整型(int)、浮点型(float)和复数(complex)</p>
</blockquote>
</li>
<li><p>String(字符串)</p>
<blockquote>
<ul>
<li>使用引号( <code>&#39;</code> 或 <code>&quot;</code> )来创建字符串;</li>
<li>三引号允许一个字符串跨多行,字符串中可以包含换行符、制表符以及其他特殊字符。</li>
</ul>
</blockquote>
</li>
<li><p>List(列表)</p>
<blockquote>
<p>列表用 <code>[ ]</code> 标识,支持字符,数字,字符串甚至可以包含列表(即嵌套)。</p>
</blockquote>
</li>
<li><p>Tuple(元组)</p>
<blockquote>
<p>元组用 <code>()</code> 标识,类似于 <code>List</code>(列表)。内部元素用逗号隔开。但是元组不能二次赋值,相当于只读列表。</p>
</blockquote>
</li>
</ul>
</summary>
<category term="Python" scheme="https://togoblog.cn/categories/Python/"/>
<category term="Python" scheme="https://togoblog.cn/tags/Python/"/>
</entry>
<entry>
<title>Flutter — 零、设置开发环境</title>
<link href="https://togoblog.cn/flutter-development-environment-configuration/"/>
<id>https://togoblog.cn/flutter-development-environment-configuration/</id>
<published>2019-05-08T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.254Z</updated>
<summary type="html">
<h3 id="一、介绍"><a href="#一、介绍" class="headerlink" title="一、介绍"></a>一、介绍</h3><ul>
<li><p><code>Flutter</code> 是由 <code>Google</code> 的工程师团队打造的,用于创建高性能、跨平台的移动应用的框架</p>
</li>
<li><p><code>Flutter</code> 针对当下以及未来的移动设备进行优化,专注于 <code>Android and iOS</code> 低延迟的输入和高帧率</p>
</li>
<li><p><code>Flutter</code> 的设计跟 <code>react-native</code> 很像,但是比 <code>RN</code> 进了一步</p>
</li>
<li><p><code>Flutter</code> 的开发语言是 <code>Dart</code></p>
</li>
<li><p><code>Flutter</code> 的热重载(<code>hot-reload</code>)特性让人惊叹,它能在编 码时为你提供超快的视觉反馈</p>
</li>
</ul>
<h3 id="二、安装"><a href="#二、安装" class="headerlink" title="二、安装"></a>二、安装</h3><h4 id="1、获取-Flutter-SDK"><a href="#1、获取-Flutter-SDK" class="headerlink" title="1、获取 Flutter SDK"></a>1、获取 Flutter SDK</h4><ul>
<li>将 <code>Flutter</code> 项目克隆到本地:
</summary>
<category term="Flutter" scheme="https://togoblog.cn/categories/Flutter/"/>
<category term="Flutter" scheme="https://togoblog.cn/tags/Flutter/"/>
</entry>
<entry>
<title>React v16.8 Hook 功能</title>
<link href="https://togoblog.cn/react-hook/"/>
<id>https://togoblog.cn/react-hook/</id>
<published>2019-04-19T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.261Z</updated>
<summary type="html">
<p><code>Hook</code> 是 <code>React v16.8</code> 的新增特性。它可以让你在不创建 <code>class</code> 式组件的情况下使用 <code>state</code> 以及其他的 <code>React</code> 特性。</p>
<h3 id="一、-React-Hook-出现的背景"><a href="#一、-React-Hook-出现的背景" class="headerlink" title="一、 React Hook 出现的背景"></a>一、 <code>React Hook</code> 出现的背景</h3><p>我们知道,<code>React</code> 的核心思想就是:将一个页面拆分成一些独立的、可复用的组件,并且用自上而下的单向数据流的形式将这些组件串联起来。 </p>
<p>但是在实际项目中,很多组件式非常冗杂且难以复用的。对于那些 <code>class</code> 式的组件,因为它们本身包含了自己的状态( <code>state</code> ),所以这类组件复用起来是非常麻烦的。对于这个问题,<code>React</code> 官方也给出了两种推荐的解决方式:</p>
<ul>
<li>渲染属性( <a href="https://reactjs.org/docs/render-props.html" target="_blank" rel="noopener"><code>Render Props</code></a> )</li>
<li>高阶组件( <a href="https://zh-hans.reactjs.org/docs/higher-order-components.html#___gatsby" target="_blank" rel="noopener"><code>Higher-Order Components</code> </a>)
</summary>
<category term="React" scheme="https://togoblog.cn/categories/React/"/>
<category term="React" scheme="https://togoblog.cn/tags/React/"/>
<category term="React Hook" scheme="https://togoblog.cn/tags/React-Hook/"/>
</entry>
<entry>
<title>React 16 中的新特性</title>
<link href="https://togoblog.cn/react-new-api-in-16/"/>
<id>https://togoblog.cn/react-new-api-in-16/</id>
<published>2019-03-22T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.261Z</updated>
<summary type="html">
<!-- ## React 16 中的新特性 -->
<p>对于 <code>React v16</code> 之后版本中的一些新特性,挑选了以下几个常用的 <code>Api</code> 来讲解 :</p>
<ul>
<li>Render 方法优化</li>
<li>错误边界</li>
<li>Portals</li>
<li>Context API</li>
<li>新的生命周期</li>
</ul>
<p>后面会持续更新。</p>
<h3 id="一、Render-方法优化"><a href="#一、Render-方法优化" class="headerlink" title="一、Render 方法优化"></a>一、Render 方法优化</h3><p>为了符合 <code>React</code> 的 <code>component tree</code> 和 <code>diff</code> 结构设计,在组件的 <code>render</code> 方法中,顶层必须包裹为单节点,因此我们在实际组件的设计和使用中,需要注意尽量避免嵌套后的层级变深。<br>
</summary>
<category term="React" scheme="https://togoblog.cn/categories/React/"/>
<category term="React" scheme="https://togoblog.cn/tags/React/"/>
<category term="Portals" scheme="https://togoblog.cn/tags/Portals/"/>
<category term="ErrorBoundary" scheme="https://togoblog.cn/tags/ErrorBoundary/"/>
</entry>
<entry>
<title>一些比较有用的 JS 技巧</title>
<link href="https://togoblog.cn/javascript-tricks/"/>
<id>https://togoblog.cn/javascript-tricks/</id>
<published>2019-01-27T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.258Z</updated>
<summary type="html">
<h4 id="1、数组去重"><a href="#1、数组去重" class="headerlink" title="1、数组去重"></a>1、数组去重</h4><pre><code class="javascript">const j = [...new Set([1, 2, 3, 3])];
console.log(j); // [ 1, 2, 3 ]
</code></pre>
<h4 id="2、过滤错误值"><a href="#2、过滤错误值" class="headerlink" title="2、过滤错误值"></a>2、过滤错误值</h4><p>将 <code>0</code>, <code>undefined</code>,<code>null</code>, <code>false</code> 等错误值从数组中剔除:</p>
<pre><code class="javascript">myArray
.map(item =&gt; {
// ...
})
// Get rid of bad values
.filter(Boolean);
</code></pre>
</summary>
<category term="JavaScript" scheme="https://togoblog.cn/categories/JavaScript/"/>
<category term="JavaScript" scheme="https://togoblog.cn/tags/JavaScript/"/>
</entry>
<entry>
<title>Vue 计算属性与侦听器</title>
<link href="https://togoblog.cn/vue-computed-watch/"/>
<id>https://togoblog.cn/vue-computed-watch/</id>
<published>2019-01-26T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.263Z</updated>
<summary type="html">
<!-- ## Vue 计算属性与侦听器 -->
<p>这一节我们一起学习 <code>vue</code> 中的计算属性(<code>computed properties</code>)和侦听器(<code>watch</code>)。</p>
<p>在之前,我们学习过 <code>vue</code> 表达式插值:</p>
<pre><code class="html">&lt;div id=&quot;example&quot;&gt;
{{ message.split('').reverse().join('') }}
&lt;/div&gt;
</code></pre>
<p>如果在模板中放入太多的逻辑会让模板过重且难以维护。我们可以把方法写在事件处理函数里面,并且在构造器内部通过 <code>this</code> 调用。<br>
</summary>
<category term="Vue" scheme="https://togoblog.cn/categories/Vue/"/>
<category term="vue" scheme="https://togoblog.cn/tags/vue/"/>
<category term="vue 计算属性" scheme="https://togoblog.cn/tags/vue-%E8%AE%A1%E7%AE%97%E5%B1%9E%E6%80%A7/"/>
<category term="vue 侦听器" scheme="https://togoblog.cn/tags/vue-%E4%BE%A6%E5%90%AC%E5%99%A8/"/>
</entry>
<entry>
<title>Vue 实例的生命周期</title>
<link href="https://togoblog.cn/vue-lifecycle/"/>
<id>https://togoblog.cn/vue-lifecycle/</id>
<published>2019-01-25T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.263Z</updated>
<summary type="html">
<!-- ## Vue 实例的生命周期 -->
<p>在 <code>Vue</code> 中,每个实例都有自己的一个完整的生命周期,包括开始创建 —— 初始化数据 —— 编译模板 —— 将实例挂载到 <code>DOM</code> —— 渲染 —— 更新 —— 渲染 —— 卸载等一系列过程。同时在这个过程中也会运行一些叫做<strong>生命周期钩子</strong>的函数,这样我们就可以在实例生命周期的不同阶段做一些需要做的事情。</p>
<h3 id="一、vue-实例和组件的区别"><a href="#一、vue-实例和组件的区别" class="headerlink" title="一、vue 实例和组件的区别"></a>一、vue 实例和组件的区别</h3><p>这里可能会有个小疑惑,怎么突然又说是 <code>Vue</code> 实例呢?实例和组件有什么区别吗?</p>
<p>在 <code>SPA(Single Page Application)</code> 应用中,我们只会创建一个 <code>Vue</code> 根实例,整个应用都是通过这个根实例启动的。在通过 <code>vue-cli</code> 脚手架生成的项目中, <code>main.js</code> 里创建了 <code>Vue</code> 根实例:<br>
</summary>
<category term="Vue" scheme="https://togoblog.cn/categories/Vue/"/>
<category term="vue" scheme="https://togoblog.cn/tags/vue/"/>
<category term="vue 生命周期" scheme="https://togoblog.cn/tags/vue-%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/"/>
</entry>
<entry>
<title>Vue 组件间的通讯</title>
<link href="https://togoblog.cn/vue-pass-data-in-components/"/>
<id>https://togoblog.cn/vue-pass-data-in-components/</id>
<published>2019-01-24T16:00:00.000Z</published>
<updated>2019-11-07T09:31:58.264Z</updated>
<summary type="html">
<!-- ## Vue 组件间的通讯 -->
<p>这一节我们一起看看 <code>vue</code> 中组件间的数据是如何传递的。</p>
<p>前面,我们已经初步建立了 <code>vue</code> 组件化的思想,知道如何创建组件、引入组件以及如何在组件里的一些功能。接下来,我们来学习怎么建立组件之间的连接,也就是组件的通讯。直白一点说就是:在一个组件中做的操作如何更新到应用程序中的其他组件。</p>
<p>这篇文章会从两个方便介绍 <code>vue</code> 组件间的通讯:</p>
<pre><code class="htm">- 父子组件之间的通讯
- 兄弟组件之间的通讯
</code></pre>
</summary>
<category term="Vue" scheme="https://togoblog.cn/categories/Vue/"/>
<category term="vue" scheme="https://togoblog.cn/tags/vue/"/>
<category term="vue 组件间通讯" scheme="https://togoblog.cn/tags/vue-%E7%BB%84%E4%BB%B6%E9%97%B4%E9%80%9A%E8%AE%AF/"/>
</entry>
</feed>