-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
721 lines (495 loc) · 28.1 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.2.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/animate.min.css">
<script class="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"chen-xt.github.io","root":"/","images":"/images","scheme":"Muse","version":"8.1.0","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果:${query}","hits_time":"找到 ${hits} 个搜索结果(用时 ${time} 毫秒)","hits":"找到 ${hits} 个搜索结果"}};
</script>
<meta name="description" content="一步一步向前走">
<meta property="og:type" content="website">
<meta property="og:title" content="十三的博客">
<meta property="og:url" content="https://chen-xt.github.io/index.html">
<meta property="og:site_name" content="十三的博客">
<meta property="og:description" content="一步一步向前走">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="chen-xt">
<meta name="twitter:card" content="summary">
<link rel="canonical" href="https://chen-xt.github.io/">
<script class="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome : true,
isPost : false,
lang : 'zh-CN'
};
</script>
<title>十三的博客</title>
<noscript>
<style>
body { margin-top: 2rem; }
.use-motion .menu-item,
.use-motion .sidebar,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header {
visibility: visible;
}
.use-motion .header,
.use-motion .site-brand-container .toggle,
.use-motion .footer { opacity: initial; }
.use-motion .site-title,
.use-motion .site-subtitle,
.use-motion .custom-logo-image {
opacity: initial;
top: initial;
}
.use-motion .logo-line {
transform: scaleX(1);
}
.search-pop-overlay, .sidebar-nav { display: none; }
.sidebar-panel { display: block; }
</style>
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
<div class="headband"></div>
<main class="main">
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="切换导航栏">
<span class="toggle-line"></span>
<span class="toggle-line"></span>
<span class="toggle-line"></span>
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<i class="logo-line"></i>
<h1 class="site-title">十三的博客</h1>
<i class="logo-line"></i>
</a>
<p class="site-subtitle" itemprop="description">前端开发</p>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
</div>
</div>
</div>
<nav class="site-nav">
<ul class="main-menu menu">
<li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
<li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
<li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
<li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
</ul>
</nav>
</div>
<div class="toggle sidebar-toggle">
<span class="toggle-line"></span>
<span class="toggle-line"></span>
<span class="toggle-line"></span>
</div>
<aside class="sidebar">
<div class="sidebar-inner sidebar-overview-active">
<ul class="sidebar-nav">
<li class="sidebar-nav-toc">
文章目录
</li>
<li class="sidebar-nav-overview">
站点概览
</li>
</ul>
<div class="sidebar-panel-container">
<!--noindex-->
<section class="post-toc-wrap sidebar-panel">
</section>
<!--/noindex-->
<section class="site-overview-wrap sidebar-panel">
<div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image" alt="chen-xt"
src="/images/head.jpg">
<p class="site-author-name" itemprop="name">chen-xt</p>
<div class="site-description" itemprop="description">一步一步向前走</div>
</div>
<div class="site-state-wrap site-overview-item animated">
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">40</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/">
<span class="site-state-item-count">11</span>
<span class="site-state-item-name">分类</span></a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/">
<span class="site-state-item-count">34</span>
<span class="site-state-item-name">标签</span></a>
</div>
</nav>
</div>
</section>
</div>
</div>
</aside>
<div class="sidebar-dimmer"></div>
</header>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<noscript>
<div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>
<div class="main-inner index posts-expand">
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://chen-xt.github.io/2022/02/09/vue%E4%B8%AD%E4%BD%BF%E7%94%A8$once%E6%B8%85%E9%99%A4%E5%AE%9A%E6%97%B6%E5%99%A8/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/head.jpg">
<meta itemprop="name" content="chen-xt">
<meta itemprop="description" content="一步一步向前走">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="十三的博客">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2022/02/09/vue%E4%B8%AD%E4%BD%BF%E7%94%A8$once%E6%B8%85%E9%99%A4%E5%AE%9A%E6%97%B6%E5%99%A8/" class="post-title-link" itemprop="url">vue中使用$once清除定时器</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2022-02-09 14:23:09 / 修改时间:14:47:02" itemprop="dateCreated datePublished" datetime="2022-02-09T14:23:09+08:00">2022-02-09</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/Vue-js/" itemprop="url" rel="index"><span itemprop="name">Vue.js</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="清理定时器的方法"><a href="#清理定时器的方法" class="headerlink" title="清理定时器的方法"></a>清理定时器的方法</h1><p>  在 vue 项目中,通常采用两种方法清理定时器,如下。</p>
<h2 id="方法一:定义-data-中定义-timer"><a href="#方法一:定义-data-中定义-timer" class="headerlink" title="方法一:定义 data 中定义 timer"></a>方法一:定义 data 中定义 timer</h2><p>  首先在 vue 实例的<code>data</code>中定义定时器的名称;然后在方法<code>methods</code>或者页面初始化<code>mounted()</code>的时候使用定时器;最后在页面销毁的生命周期函数<code>beforeDestroy()</code>中销毁定时器。</p>
<figure class="highlight js"><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"><span class="keyword">export</span> <span class="keyword">default</span>{</span><br><span class="line"> <span class="function"><span class="title">data</span>(<span class="params"></span>)</span>{</span><br><span class="line"> timer:<span class="literal">null</span></span><br><span class="line"> },</span><br><span class="line"> <span class="function"><span class="title">mounted</span>(<span class="params"></span>)</span>{</span><br><span class="line"> <span class="built_in">this</span>.timer = <span class="built_in">setInterval</span>(<span class="function">()=></span>{</span><br><span class="line"> <span class="built_in">console</span>.log(<span class="string">'123'</span>);</span><br><span class="line"> },<span class="number">1000</span>);</span><br><span class="line"> }</span><br><span class="line"> <span class="function"><span class="title">beforeDestory</span>(<span class="params"></span>)</span>{</span><br><span class="line"> <span class="built_in">clearInterval</span>(<span class="built_in">this</span>.timer);</span><br><span class="line"> <span class="built_in">this</span>.timer = <span class="literal">null</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2022/02/09/vue%E4%B8%AD%E4%BD%BF%E7%94%A8$once%E6%B8%85%E9%99%A4%E5%AE%9A%E6%97%B6%E5%99%A8/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://chen-xt.github.io/2021/12/21/%E5%AD%A6%E4%B9%A0JavaScript%E2%80%94%E2%80%94this%E7%BB%91%E5%AE%9A/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/head.jpg">
<meta itemprop="name" content="chen-xt">
<meta itemprop="description" content="一步一步向前走">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="十三的博客">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/12/21/%E5%AD%A6%E4%B9%A0JavaScript%E2%80%94%E2%80%94this%E7%BB%91%E5%AE%9A/" class="post-title-link" itemprop="url">学习JavaScript——this绑定</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2021-12-21 11:32:56" itemprop="dateCreated datePublished" datetime="2021-12-21T11:32:56+08:00">2021-12-21</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">更新于</span>
<time title="修改时间:2021-12-22 16:34:09" itemprop="dateModified" datetime="2021-12-22T16:34:09+08:00">2021-12-22</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/javascript/" itemprop="url" rel="index"><span itemprop="name">javascript</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="什么是-this"><a href="#什么是-this" class="headerlink" title="什么是 this"></a>什么是 this</h1><p>  <code>this</code>是当前执行上下文(global、function 或 eval)的一个属性。在非严格模式下,总是指向一个对象;在严格模式下可以是任意值。</p>
<ol>
<li>无论是否在严格模式下,在全局执行环境中(在任何函数体外部)<code>this</code>都指向全局对象<code>window</code>。</li>
</ol>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 在浏览器中, window 对象同时也是全局对象:</span></span><br><span class="line"><span class="built_in">console</span>.log(<span class="built_in">this</span>); <span class="comment">// window</span></span><br></pre></td></tr></table></figure>
<ol start="2">
<li>在函数内部,<code>this</code>的值取决于函数被调用的方式。非严格模式下,函数内部的<code>this</code>指向<code>window</code>;严格模式下,如果进入执行环境时没有设置<code>this</code>的值,<code>this</code>会保持为<code>undefined</code>。</li>
</ol>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2021/12/21/%E5%AD%A6%E4%B9%A0JavaScript%E2%80%94%E2%80%94this%E7%BB%91%E5%AE%9A/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://chen-xt.github.io/2021/12/08/JS%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E5%8F%8A%E7%B1%BB%E5%9E%8B%E5%88%A4%E6%96%AD/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/head.jpg">
<meta itemprop="name" content="chen-xt">
<meta itemprop="description" content="一步一步向前走">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="十三的博客">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/12/08/JS%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E5%8F%8A%E7%B1%BB%E5%9E%8B%E5%88%A4%E6%96%AD/" class="post-title-link" itemprop="url">JS数据类型及类型判断</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2021-12-08 18:05:48" itemprop="dateCreated datePublished" datetime="2021-12-08T18:05:48+08:00">2021-12-08</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i>
</span>
<span class="post-meta-item-text">更新于</span>
<time title="修改时间:2021-12-16 15:03:53" itemprop="dateModified" datetime="2021-12-16T15:03:53+08:00">2021-12-16</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/javascript/" itemprop="url" rel="index"><span itemprop="name">javascript</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h1><p>  JS 数据类型分为两类:原始数据类型和引用数据类型。</p>
<h2 id="原始数据类型"><a href="#原始数据类型" class="headerlink" title="原始数据类型"></a>原始数据类型</h2><p>  原始数据类型的特点:值保存在变量本地,且赋值给其他变量后,其它变量改变不影响原来的值,变量存放在栈区(栈区指内存里的栈内存)。<br>  原始数据类型有七种,分别是<strong>Number</strong>、<strong>String</strong>、<strong>Boolean</strong>、<strong>Null</strong>、<strong>Undefined</strong>、<strong>Symbol</strong> 、 <strong>BigInt</strong>。</p>
<h2 id="引用数据类型"><a href="#引用数据类型" class="headerlink" title="引用数据类型"></a>引用数据类型</h2>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2021/12/08/JS%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E5%8F%8A%E7%B1%BB%E5%9E%8B%E5%88%A4%E6%96%AD/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://chen-xt.github.io/2021/08/06/%E8%A7%A3%E5%86%B3%E4%BD%BF%E7%94%A8ESLint%EF%BC%8C%E5%87%BA%E7%8E%B0%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E5%8F%8C%E5%BC%95%E5%8F%B7%E3%80%81%E5%88%86%E5%8F%B7%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A7%84%E8%8C%83%E7%9A%84%E6%8A%A5%E9%94%99/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/head.jpg">
<meta itemprop="name" content="chen-xt">
<meta itemprop="description" content="一步一步向前走">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="十三的博客">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/08/06/%E8%A7%A3%E5%86%B3%E4%BD%BF%E7%94%A8ESLint%EF%BC%8C%E5%87%BA%E7%8E%B0%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E5%8F%8C%E5%BC%95%E5%8F%B7%E3%80%81%E5%88%86%E5%8F%B7%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A7%84%E8%8C%83%E7%9A%84%E6%8A%A5%E9%94%99/" class="post-title-link" itemprop="url">解决使用ESLint,出现代码中的双引号、分号不符合规范的报错</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2021-08-06 11:19:43 / 修改时间:13:35:05" itemprop="dateCreated datePublished" datetime="2021-08-06T11:19:43+08:00">2021-08-06</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/Vue-js/" itemprop="url" rel="index"><span itemprop="name">Vue.js</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h2><p>   vue-cli 构建的项目默认启用 ESLint 进行代码检测,凡是不符合它规范的就会报错,但是 vscode 代码格式化中的有些规则和 ESLint 规则相反。</p>
<ol>
<li>按 ESLint 的规则:单引号,末尾没有分号</li>
</ol>
<figure class="highlight plain"><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></pre></td><td class="code"><pre><span class="line"><script></span><br><span class="line">export default {</span><br><span class="line"> name: 'HelloWorld',</span><br><span class="line">}</span><br><span class="line"></script></span><br></pre></td></tr></table></figure>
<ol start="2">
<li>使用 vscode 的格式化:双引号,末尾带分号</li>
</ol>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2021/08/06/%E8%A7%A3%E5%86%B3%E4%BD%BF%E7%94%A8ESLint%EF%BC%8C%E5%87%BA%E7%8E%B0%E4%BB%A3%E7%A0%81%E4%B8%AD%E7%9A%84%E5%8F%8C%E5%BC%95%E5%8F%B7%E3%80%81%E5%88%86%E5%8F%B7%E4%B8%8D%E7%AC%A6%E5%90%88%E8%A7%84%E8%8C%83%E7%9A%84%E6%8A%A5%E9%94%99/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://chen-xt.github.io/2021/06/08/js%E9%A9%BC%E5%B3%B0%E5%BC%8F%E5%92%8C%E4%B8%8B%E6%A8%AA%E7%BA%BF%E4%BA%92%E8%BD%AC/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/head.jpg">
<meta itemprop="name" content="chen-xt">
<meta itemprop="description" content="一步一步向前走">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="十三的博客">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/06/08/js%E9%A9%BC%E5%B3%B0%E5%BC%8F%E5%92%8C%E4%B8%8B%E6%A8%AA%E7%BA%BF%E4%BA%92%E8%BD%AC/" class="post-title-link" itemprop="url">js驼峰式和下横线互转</a>
</h2>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2021-06-08 11:25:07 / 修改时间:13:58:53" itemprop="dateCreated datePublished" datetime="2021-06-08T11:25:07+08:00">2021-06-08</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/javascript/" itemprop="url" rel="index"><span itemprop="name">javascript</span></a>
</span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="什么是驼峰命名法"><a href="#什么是驼峰命名法" class="headerlink" title="什么是驼峰命名法"></a>什么是驼峰命名法</h1><p>  <strong>1. 小驼峰命名法:</strong>除第一个单词之外,其他单词首字母大写,如<code>bizType</code>。常用于变量名,函数名。</p>
<p>  <strong>2. 大驼峰命名法:</strong>单词首字母都大写,如<code>BizType</code>。常用于类名,属性,命名空间等。</p>
<h1 id="什么是下划线命名法"><a href="#什么是下划线命名法" class="headerlink" title="什么是下划线命名法"></a>什么是下划线命名法</h1><p>  <strong>下划线命名法:</strong>名称中的每一个逻辑断点都用一个下划线来标记,如<code>biz_type</code>。</p>
<!--noindex-->
<div class="post-button">
<a class="btn" href="/2021/06/08/js%E9%A9%BC%E5%B3%B0%E5%BC%8F%E5%92%8C%E4%B8%8B%E6%A8%AA%E7%BA%BF%E4%BA%92%E8%BD%AC/#more" rel="contents">
阅读全文 »
</a>
</div>
<!--/noindex-->
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
</div>
<nav class="pagination">
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><span class="space">…</span><a class="page-number" href="/page/8/">8</a><a class="extend next" rel="next" href="/page/2/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
</nav>
<script>
window.addEventListener('tabs:register', () => {
let { activeClass } = CONFIG.comments;
if (CONFIG.comments.storage) {
activeClass = localStorage.getItem('comments_active') || activeClass;
}
if (activeClass) {
const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
if (activeTab) {
activeTab.click();
}
}
});
if (CONFIG.comments.storage) {
window.addEventListener('tabs:click', event => {
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
const commentClass = event.target.classList[1];
localStorage.setItem('comments_active', commentClass);
});
}
</script>
</div>
</main>
<footer class="footer">
<div class="footer-inner">
<div class="copyright">
©
<span itemprop="copyrightYear">2022</span>
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">chen-xt</span>
</div>
</div>
</footer>
<script src="//cdn.jsdelivr.net/npm/[email protected]/lib/anime.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>
</body>
</html>