<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>前端 on Bigshans&#39; Blog</title>
    <link>https://bigshans.github.io/tags/%E5%89%8D%E7%AB%AF/</link>
    <description>Recent content in 前端 on Bigshans&#39; Blog</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>bigshans</copyright>
    <lastBuildDate>Wed, 04 Mar 2026 19:46:28 +0800</lastBuildDate>
    <atom:link href="https://bigshans.github.io/tags/%E5%89%8D%E7%AB%AF/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Vue 的响应式原理</title>
      <link>https://bigshans.github.io/post/vue_s_reactive/</link>
      <pubDate>Wed, 04 Mar 2026 19:46:28 +0800</pubDate>
      <guid>https://bigshans.github.io/post/vue_s_reactive/</guid>
      <description>&lt;p&gt;Vue 3 使用 &lt;code&gt;Proxy&lt;/code&gt; 是一大创举，它成功解决了 Vue 2&#xA;无法追踪新增属性的问题。不过，仅仅是如此吗？不如我们用简单的代码实现一个&#xA;&lt;code&gt;reactive&lt;/code&gt; 看看。&lt;/p&gt;&#xA;&lt;div class=&#34;sourceCode&#34; id=&#34;cb1&#34;&gt;&lt;pre class=&#34;sourceCode javascript&#34;&gt;&lt;code class=&#34;sourceCode javascript&#34;&gt;&lt;span id=&#34;cb1-1&#34;&gt;&lt;a href=&#34;#cb1-1&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;&lt;span class=&#34;kw&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;fu&#34;&gt;reactive&lt;/span&gt;(target) {&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-2&#34;&gt;&lt;a href=&#34;#cb1-2&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;  &lt;span class=&#34;cf&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;kw&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;bu&#34;&gt;Proxy&lt;/span&gt;(target&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; {&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-3&#34;&gt;&lt;a href=&#34;#cb1-3&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;    &lt;span class=&#34;kw&#34;&gt;get&lt;/span&gt;(target&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; key&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; recevier) {&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-4&#34;&gt;&lt;a href=&#34;#cb1-4&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;      &lt;span class=&#34;cf&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;bu&#34;&gt;Reflect&lt;/span&gt;&lt;span class=&#34;op&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;fu&#34;&gt;get&lt;/span&gt;(target&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; key&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; recevier)&lt;span class=&#34;op&#34;&gt;;&lt;/span&gt;&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-5&#34;&gt;&lt;a href=&#34;#cb1-5&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;    }&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt;&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-6&#34;&gt;&lt;a href=&#34;#cb1-6&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;    &lt;span class=&#34;kw&#34;&gt;set&lt;/span&gt;(target&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; key&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; value&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; recevier) {&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-7&#34;&gt;&lt;a href=&#34;#cb1-7&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;      &lt;span class=&#34;cf&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;bu&#34;&gt;Reflect&lt;/span&gt;&lt;span class=&#34;op&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;fu&#34;&gt;set&lt;/span&gt;(target&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; key&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; value&lt;span class=&#34;op&#34;&gt;,&lt;/span&gt; recevier)&lt;span class=&#34;op&#34;&gt;;&lt;/span&gt;&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-8&#34;&gt;&lt;a href=&#34;#cb1-8&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;    }&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-9&#34;&gt;&lt;a href=&#34;#cb1-9&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;  })&lt;span class=&#34;op&#34;&gt;;&lt;/span&gt;&lt;/span&gt;&#xA;&lt;span id=&#34;cb1-10&#34;&gt;&lt;a href=&#34;#cb1-10&#34; aria-hidden=&#34;true&#34; tabindex=&#34;-1&#34;&gt;&lt;/a&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;这里，&lt;code&gt;Reflect&lt;/code&gt; 和 &lt;code&gt;Proxy()&lt;/code&gt;&#xA;是配套的，等同于我们直接对 &lt;code&gt;target[key]&lt;/code&gt; 进行操作，但用&#xA;&lt;code&gt;Reflect&lt;/code&gt; 更加方便，也更加安全。我们可以通过在拦截器层面增加&#xA;&lt;code&gt;console.log()&lt;/code&gt; 来查看效果。&lt;/p&gt;</description>
    </item>
    <item>
      <title>BFC 简述</title>
      <link>https://bigshans.github.io/post/bfc/</link>
      <pubDate>Sun, 06 Aug 2023 19:09:10 +0800</pubDate>
      <guid>https://bigshans.github.io/post/bfc/</guid>
      <description>&lt;p&gt;BFC&#xA;指块格式上下文。格式上下文定义了一个元素内部如何排布，以及与外部元素间如何排布。BFC&#xA;即定义了块元素的格式上下文。&lt;/p&gt;&#xA;&lt;p&gt;默认情况下，&lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt;&#xA;为块格式上下文。块元素的子元素将按块排布，或者按行排布，如果出现混合排布的情况，则会将内联元素用匿名块包裹起来，然后按块排布。同时，匿名块不能被&#xA;CSS 指定，不受 CSS 样式影响。&lt;/p&gt;</description>
    </item>
    <item>
      <title>如何正确的替换 HTML</title>
      <link>https://bigshans.github.io/post/sethtml/</link>
      <pubDate>Sat, 18 Feb 2023 14:08:26 +0800</pubDate>
      <guid>https://bigshans.github.io/post/sethtml/</guid>
      <description>&lt;p&gt;算是私人页的一个 BUG ，之前没有注意到。使用 &lt;code&gt;innerHTML&lt;/code&gt; 进行替换后，替换内容内所有的 &lt;code&gt;script&lt;/code&gt; 都失效了，这是符合浏览器预期的，可见 MDN 。&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Although this may look like a cross-site scripting attack, the result is harmless. HTML specifies that a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag inserted with innerHTML should not execute.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CSS 盒子模型</title>
      <link>https://bigshans.github.io/post/css-box/</link>
      <pubDate>Fri, 13 Jan 2023 09:27:13 +0800</pubDate>
      <guid>https://bigshans.github.io/post/css-box/</guid>
      <description>&lt;p&gt;一个 HTML 文档在浏览器内将会被解析为一棵文档树，这是众所周知的。 CSS&#xA;的盒子模型则描述了文档上的每一个节点所生成的模型，这是 CSS&#xA;布局排版的基础。&lt;/p&gt;&#xA;&lt;h2 id=&#34;标准盒型&#34;&gt;标准盒型&lt;/h2&gt;&#xA;&lt;figure&gt;&#xA;&lt;img src=&#34;https://www.w3.org/TR/2016/WD-CSS22-20160412/images/boxdim.png&#34; alt=&#34;盒子模型示意图&#34;/&gt;&#xA;&lt;figcaption aria-hidden=&#34;true&#34;&gt;盒子模型示意图&lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;每一个盒子都一块内容（content）区域，围绕内容从内向外分别是内边距、边框和外边距（padding&#xA;、 border 、 margin）。&lt;/p&gt;</description>
    </item>
    <item>
      <title>CSS 三栏布局</title>
      <link>https://bigshans.github.io/post/css%E4%B8%89%E6%A0%8F%E5%B8%83%E5%B1%80/</link>
      <pubDate>Tue, 10 Jan 2023 09:27:35 +0800</pubDate>
      <guid>https://bigshans.github.io/post/css%E4%B8%89%E6%A0%8F%E5%B8%83%E5%B1%80/</guid>
      <description>&lt;p&gt;三栏布局是比较经典的 CSS&#xA;布局，特点就是中间内容自适应，首先渲染，其次左右内容大小保持不变分布两旁。结构上打破了一般意义上的左中右的顺序，变成了中左右的顺序，但视觉展示仍然要求是左中右的布局，于是，如何将中间内容放回到中间，并重新分布左右则是此类技术的核心所在。在&#xA;&lt;code&gt;flex&lt;/code&gt; 之前，前端多用 &lt;code&gt;float&lt;/code&gt;&#xA;实现，出现了双飞翼和圣杯布局两种实现，现在我们可以用 &lt;code&gt;flex&lt;/code&gt;&#xA;来很简单的实现。&lt;/p&gt;</description>
    </item>
    <item>
      <title>sort 在 Chrome 和 Firefox 表现不同</title>
      <link>https://bigshans.github.io/post/different-sort-between-firefox-and-chrome/</link>
      <pubDate>Thu, 31 Mar 2022 10:18:10 +0800</pubDate>
      <guid>https://bigshans.github.io/post/different-sort-between-firefox-and-chrome/</guid>
      <description>&lt;p&gt;首先，这个区别不算 BUG ，因为标准并没有规定该怎么排，但这个细微区别在实现一些特殊需求时需要被注意到。&lt;/p&gt;&#xA;&lt;p&gt;注意下面一段代码：&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-javascript&#34;&gt;var a = [1, 1, 1, 1, 1];&#xA;a = a.map((k, i) =&amp;gt; ({ a: k, i: i }));&#xA;function cmp(a, b) {&#xA;  console.log(a.index, b.index);&#xA;  return a.a - b.a;&#xA;}&#xA;a.sort(cmp);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Firefox 的结果：&lt;/p&gt;</description>
    </item>
    <item>
      <title>Angular 简易入门</title>
      <link>https://bigshans.github.io/post/getting-started-with-angular/</link>
      <pubDate>Mon, 06 Dec 2021 09:29:04 +0800</pubDate>
      <guid>https://bigshans.github.io/post/getting-started-with-angular/</guid>
      <description>&lt;p&gt;因为最近重新用了用 Angular ，在有了 Vue 和 React 的使用经验之后，对 Angular 又有了新的理解。 Angular 是真正意义上与 Vue 和 React 区分的框架，因为其思想与二者截然不同。不过我不讨论这个，我是来讲 Angular 入门。&lt;/p&gt;</description>
    </item>
    <item>
      <title>drop-shadow 隐藏原始图像</title>
      <link>https://bigshans.github.io/post/drop-shadow-hidden-origin-image/</link>
      <pubDate>Fri, 03 Dec 2021 16:32:50 +0800</pubDate>
      <guid>https://bigshans.github.io/post/drop-shadow-hidden-origin-image/</guid>
      <description>&lt;p&gt;看到张鑫大佬的&lt;a href=&#34;https://www.zhangxinxu.com/wordpress/2016/06/png-icon-change-color-by-css/&#34;&gt;这篇文章&lt;/a&gt;很有意思。&lt;/p&gt;&#xA;&lt;p&gt;张鑫大佬讲述了如何使用 &lt;code&gt;filter&lt;/code&gt; 中的 &lt;code&gt;drop-shadow&lt;/code&gt; 实现 png 图标改颜色的技巧，本质上是利用阴影偏移实现的。不过我有一点我一直没有搞明白就是如何将原始图像遮住。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Nginx 按路由分流请求</title>
      <link>https://bigshans.github.io/post/nginx-route-to-different-items-by-address/</link>
      <pubDate>Tue, 30 Nov 2021 14:04:23 +0800</pubDate>
      <guid>https://bigshans.github.io/post/nginx-route-to-different-items-by-address/</guid>
      <description>&lt;p&gt;一个很恶心的需求，到部署最后部署的时候才发现问题很大，但只好死马当活马医了。&lt;/p&gt;&#xA;&lt;p&gt;我们目前搞了两个项目，其中一个项目是传统 Vue 项目，另一个是 Angular SSR ，刚开始的时候，我们设想两个项目会由 Nginx 根据路由进行分流请求到不同项目，这样我们就可以不用将全部项目改造为 SSR 。设想很美好，但是我们漏考虑了一个点，我接下来就会说。&lt;/p&gt;</description>
    </item>
    <item>
      <title>为什么 overflow 能够清除 float</title>
      <link>https://bigshans.github.io/post/why-bfc-can-clear-flow/</link>
      <pubDate>Sun, 07 Nov 2021 17:27:40 +0800</pubDate>
      <guid>https://bigshans.github.io/post/why-bfc-can-clear-flow/</guid>
      <description>&lt;p&gt;有些学问还是自己研究最为靠谱，像是 &lt;code&gt;overflow&lt;/code&gt; 为什么能清 &lt;code&gt;float&lt;/code&gt; ，都知道是 BFC ，但是为什么呢？因为在文档流中，普通的 &lt;code&gt;div&lt;/code&gt; 其实也是 &lt;code&gt;BFC&lt;/code&gt; ，所以，理论上添加 &lt;code&gt;overflow&lt;/code&gt; 为非 &lt;code&gt;visible&lt;/code&gt; 的时候，它也仍然是 BFC 啊？所以，问题在哪里呢？&lt;/p&gt;</description>
    </item>
    <item>
      <title>Vue 3.2 &lt;script setup&gt; 摘要</title>
      <link>https://bigshans.github.io/post/vue3_2-setup/</link>
      <pubDate>Thu, 26 Aug 2021 15:43:34 +0800</pubDate>
      <guid>https://bigshans.github.io/post/vue3_2-setup/</guid>
      <description>&lt;p&gt;在 Vue 3.2 发布的内容中，最主要内容就是 &lt;code&gt;&amp;lt;script setup&amp;gt;&lt;/code&gt; 。 &lt;code&gt;&amp;lt;script setup&amp;gt;&lt;/code&gt; 想必大家都有使用过，跟当初作为实验特性不同，这次正式发布还是有很多的修改的。&lt;/p&gt;&#xA;&lt;h2 id=&#34;废除-usecontext&#34;&gt;废除 &lt;code&gt;useContext()&lt;/code&gt;&lt;/h2&gt;&#xA;&lt;p&gt;原先获取全局 &lt;code&gt;ctx&lt;/code&gt; 的方法就是 &lt;code&gt;useContext()&lt;/code&gt; ，现在不行了。 Vue 还是希望用户摆脱全局变量的使用，进而使用 &lt;code&gt;useXXX&lt;/code&gt; 代替。利弊各有吧，总体来说利大于弊。&lt;/p&gt;</description>
    </item>
    <item>
      <title>如何编写一个 Chrome 扩展</title>
      <link>https://bigshans.github.io/post/chrome-extensions/</link>
      <pubDate>Sun, 15 Aug 2021 14:48:54 +0800</pubDate>
      <guid>https://bigshans.github.io/post/chrome-extensions/</guid>
      <description>&lt;p&gt;最近工作需要用到 Chrome 扩展，于是就特意学习了一下。起初，我以为 Chrome 扩展权限挺大，操作起来应该挺方便的，但是，实际情况各种权限需要申请，而且有些操作还要不停的绕过，写起来也是挺烦的。&lt;/p&gt;</description>
    </item>
    <item>
      <title>写了一个基于 art 的静态网页模块化项目</title>
      <link>https://bigshans.github.io/post/art-html/</link>
      <pubDate>Mon, 24 May 2021 22:19:11 +0800</pubDate>
      <guid>https://bigshans.github.io/post/art-html/</guid>
      <description>&lt;p&gt;最近写的一个小项目，感觉很有意思就与大家分享一下，当然我给的这个是 Demo 。项目地址是 &lt;a href=&#34;https://github.com/bigshans/art-html&#34;&gt;https://github.com/bigshans/art-html&lt;/a&gt; 。&lt;/p&gt;&#xA;&lt;h2 id=&#34;背景&#34;&gt;背景&lt;/h2&gt;&#xA;&lt;p&gt;公司的主页是用静态网页写的，主要是用来展示，但是分很多个页面，页面间有几个公用的组件。首先不考虑用 Vue 或者 React ，杀鸡焉用牛刀是其一，其二是首页需要做 SEO ，但是特意用一个 Nuxtjs 的又不太想（不需要那么多东西），我的 Leader 不太想再弄一个服务去跑这个东西，因为原来就直接丢到 OSS 上不需要管，根本不用考虑它对服务器的影响（反正又是找阿里就行了）。考虑了几种方案，感觉还是用传统的模板引擎最好，因为返回给前端的时候直接是生成好的页面，SEO 肯定没问题，问题是不开一个服务怎么弄呢？那就提前生成好就行了。&lt;/p&gt;</description>
    </item>
    <item>
      <title>前端学习之路</title>
      <link>https://bigshans.github.io/post/study-front-end-way/</link>
      <pubDate>Sun, 11 Apr 2021 15:58:45 +0800</pubDate>
      <guid>https://bigshans.github.io/post/study-front-end-way/</guid>
      <description>&lt;p&gt;我在大学里面学的还是 Java ，然后工作之后，就一直在用 Node ，从一开始的 Node 后端，到现在的 Node 全栈，可以说是学习了不少，今天就在这里与大家分享一下我前端学习的一些经验之说，希望能对大家有帮助。&lt;/p&gt;</description>
    </item>
    <item>
      <title>用 Svelte 写个简单的 Todo</title>
      <link>https://bigshans.github.io/post/svelte-todo/</link>
      <pubDate>Tue, 16 Feb 2021 20:30:32 +0800</pubDate>
      <guid>https://bigshans.github.io/post/svelte-todo/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;官网： &lt;a href=&#34;https://svelte.dev/&#34;&gt;https://svelte.dev/&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;Svelte 是个新的前端框架，发展强劲。与目前主流的三大框架不同的是，Svelte 不采用 vdom ，而是借助 complier 的能力，打包出最小化的包，不附带更多的 runtime 。Svelte 是由 rollup 作者开发的 Reative 框架，语法与 vue 很像，个人简单写了一下，速度是真的给力，打包也是真的简洁。&lt;/p&gt;</description>
    </item>
    <item>
      <title>css绘制三角形</title>
      <link>https://bigshans.github.io/post/css%E7%BB%98%E5%88%B6%E4%B8%89%E8%A7%92%E5%BD%A2/</link>
      <pubDate>Sun, 22 Dec 2019 21:21:47 +0000</pubDate>
      <guid>https://bigshans.github.io/post/css%E7%BB%98%E5%88%B6%E4%B8%89%E8%A7%92%E5%BD%A2/</guid>
      <description>&lt;p&gt;最近写前端要一个下拉箭头，所以选择用 css 画一个三角形来用，话不多说，看代码：&lt;/p&gt;</description>
    </item>
    <item>
      <title>angular 虚拟滚动的一些坑</title>
      <link>https://bigshans.github.io/post/angular-virtual-scroll/</link>
      <pubDate>Sun, 08 Dec 2019 20:23:42 +0000</pubDate>
      <guid>https://bigshans.github.io/post/angular-virtual-scroll/</guid>
      <description>&lt;p&gt;最近被赶过去写前端了。&lt;/p&gt;</description>
    </item>
    <item>
      <title>js 实现 DOM 监视</title>
      <link>https://bigshans.github.io/post/js-dom-watch/</link>
      <pubDate>Sun, 07 Oct 2018 15:53:19 +0000</pubDate>
      <guid>https://bigshans.github.io/post/js-dom-watch/</guid>
      <description>&lt;p&gt;花了点时间做了 b 站评论区地址链接化，比较麻烦的是 DOM 监视。找了很多，最后还是采用了 Muatation 来进行事件监视。&lt;/p&gt;&#xA;&lt;p&gt;给个文档地址：http://javascript.ruanyifeng.com/dom/mutationobserver.html 。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
