<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 打coding的奥特曼</title>
    <description>The latest articles on DEV Community by 打coding的奥特曼 (@kongfuboy123).</description>
    <link>https://dev.to/kongfuboy123</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F682890%2F01be9bc3-b6dd-4757-b22e-b2a28d1c22f6.PNG</url>
      <title>DEV Community: 打coding的奥特曼</title>
      <link>https://dev.to/kongfuboy123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kongfuboy123"/>
    <language>en</language>
    <item>
      <title>Implement Dark Mode in Tailwind React Application</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Mon, 04 Jul 2022 12:42:40 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/implement-dark-mode-in-tailwind-react-application-4dfb</link>
      <guid>https://dev.to/kongfuboy123/implement-dark-mode-in-tailwind-react-application-4dfb</guid>
      <description>&lt;h1&gt;
  
  
  1.active dark mode in tailwind.config.js
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  darkMode: 'class',
  theme: {
    extend: {
    },
  },
  plugins: [],
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  2. set dark mode in App.js , and pass {dark,setDark} to  ,in which we set the toggle method in
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function App() {
  const [dark,setDark]=useState(false);
  return (
    &amp;lt;div className={dark?"dark":''}&amp;gt;
      &amp;lt;Nav props={{dark,setDark}}/&amp;gt;
      &amp;lt;Routes&amp;gt;
        &amp;lt;Route path="/" element={&amp;lt;Home /&amp;gt;}/&amp;gt;
      &amp;lt;/Routes&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  3.set the toggle in the  component
&lt;/h1&gt;

&lt;p&gt;Nav.jsx,sun and moon are the icon you choose for it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Nav({props}) {
  const {dark,setDark} = props
  const handleClick = ()=&amp;gt;{
    setDark(!dark)
  }
  return (
  &amp;lt;&amp;gt;
   &amp;lt;img src={dark?sun:moon} alt="toggle" className="w-5 h-5 
    absolute cursor-pointer" onClick={handleClick}/&amp;gt;
  &amp;lt;/&amp;gt;
export default Nav;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  4. add dark mode to the components ,such as About.js
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function About(props) {
  console.log(skills)
  return (
    &amp;lt;div id='about' className=' dark:bg-gray-700 dark:text-white'&amp;gt;

    &amp;lt;/div&amp;gt;
  );
}

export default About;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>一行代码把句子里的每个单词首字母大写</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Sat, 04 Jun 2022 11:41:17 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/xing-dai-ma-ba-ju-zi-li-de-mei-ge-dan-ci-shou-zi-mu-da-xie-97j</link>
      <guid>https://dev.to/kongfuboy123/xing-dai-ma-ba-ju-zi-li-de-mei-ge-dan-ci-shou-zi-mu-da-xie-97j</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;str = 'hello world, today is saturday'
str.split(' ').map( i =&amp;gt;  i[0].toUpperCase()+i.slice(1)   
    ).join(' ')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>react在非受控下读取form表单</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Mon, 22 Nov 2021 06:32:23 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/reactzai-fei-shou-kong-xia-du-qu-formbiao-dan-3akd</link>
      <guid>https://dev.to/kongfuboy123/reactzai-fei-shou-kong-xia-du-qu-formbiao-dan-3akd</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const Form = ()=&amp;gt;{
 const handleSubmit = (e)=&amp;gt;{
    e.preventDefault();
    const formData = new FormData(e.target)
    const data = Object.fromEntries(formData.entries())
    console.log(data )
}

return (
 &amp;lt;form  onSubmit={handleSubmit} &amp;gt;
    &amp;lt;input type="text" name='username'  placeholder='username'/&amp;gt;
    &amp;lt;input type="email" name='email' placeholder='email'/&amp;gt;
    &amp;lt;input type="password" name='password' placeholder='password'  /&amp;gt;
    &amp;lt;input type="password"  placeholder='confirm password' /&amp;gt;    
     &amp;lt;button&amp;gt;submit&amp;lt;/button&amp;gt;
  &amp;lt;/form&amp;gt;
)
}
export default Form

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>react 5分钟写一个乐透开奖</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Thu, 28 Oct 2021 13:08:33 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/react-5fen-zhong-xie-ge-le-tou-kai-jiang-37hl</link>
      <guid>https://dev.to/kongfuboy123/react-5fen-zhong-xie-ge-le-tou-kai-jiang-37hl</guid>
      <description>&lt;p&gt;先放个效果图&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4LVXBmbE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iw1wzdlrebffw6vhw6vm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4LVXBmbE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iw1wzdlrebffw6vhw6vm.png" alt="Image description" width="880" height="359"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import { useState } from 'react';
const Lottery = () =&amp;gt; {
  const [pool,setPool]=useState([]) // 设置奖池初始值
  // 生成一个随机数字
  const randomNumber = (min, max) =&amp;gt;{
    const range = max - min + 1;
    const rand = Math.random() ;
    const num = Math.floor(rand * range + min);
    return num;
  }
  // 奖池生成器 
  const generator = (n，min，max)=&amp;gt;{
    const arr = [];
    while(arr.length&amp;lt;n){
      const num = randomNumber(min,max)
      if (arr.indexOf(num)===-1){
        arr.push(num)
      }
    }
    return arr;
  }

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={()=&amp;gt;setPool(generator(6，1,45))}&amp;gt;一键开奖&amp;lt;/button&amp;gt;
      &amp;lt;button onClick={()=&amp;gt;setPool([])}&amp;gt;清空奖池&amp;lt;/button&amp;gt;

      &amp;lt;div className="lottery"&amp;gt;
        &amp;lt;ul&amp;gt;
          {pool.map((num,i)=&amp;gt;(&amp;lt;li key={i}&amp;gt;&amp;lt;div&amp;gt;{num}&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;))}
        &amp;lt;/ul&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default Lottery;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>补充一个对象数组去重</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Thu, 09 Sep 2021 04:27:17 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/-k1j</link>
      <guid>https://dev.to/kongfuboy123/-k1j</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const _ = require('lodash') ;
const arr = [{a:1},{b:1},{c:1},{c:1},{e:1},{a:1}];
const res = _.uniqWith(arr,_.isEqual);
console.log(res);//[ { a: 1 }, { b: 1 }, { c: 1 }, { e: 1 } ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>规范姓名格式</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Wed, 08 Sep 2021 14:23:30 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/-5gi3</link>
      <guid>https://dev.to/kongfuboy123/-5gi3</guid>
      <description>&lt;p&gt;请把用户输入的不规范的英文名字，变为首字母大写，其他小写的规范名字。输入：['adam', 'LISA', 'barT']，输出：['Adam', 'Lisa', 'Bart']。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const list = ['adam', 'LISA', 'barT'];
const normalizeStr = str=&amp;gt;str.slice(0,1).toUpperCase()+str.slice(1).toLowerCase();
const normalize = list=&amp;gt;list.map(x =&amp;gt; normalizeStr(x));
console.log(normalize(list));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>不使用JavaScript内置的parseInt()函数，利用map和reduce操作实现一个string2int()函数</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Tue, 07 Sep 2021 01:10:14 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/javascript-parseint-map-reduce-string2int-1gf3</link>
      <guid>https://dev.to/kongfuboy123/javascript-parseint-map-reduce-string2int-1gf3</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str2int = s=&amp;gt;[].slice.apply(s).map(x=&amp;gt;+x).reduce((x,y)=&amp;gt;x*10+y);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;1.利用[].slice.apply(s)将s 拆成字符串数组&lt;br&gt;
2.利用+将string转换成number，用map遍历，map(x=&amp;gt;+x)，&lt;br&gt;
3.利用reduce把数组转化成一个数字&lt;br&gt;
打印结果如下：&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AeycHMGo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c11cklk7u6d6xeu3ecv9.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AeycHMGo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c11cklk7u6d6xeu3ecv9.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
补充，使用Array.from 可以节省掉map&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str2int = s=&amp;gt;Array.from(s,x=&amp;gt;+x).reduce((x,y)=&amp;gt;x*10+y)
console.log(str2int('12345'));  //12345
console.log(typeof str2int('12345')); //number
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>去重</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Mon, 06 Sep 2021 07:39:12 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/-3l86</link>
      <guid>https://dev.to/kongfuboy123/-3l86</guid>
      <description>&lt;h1&gt;
  
  
  方法 1
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const arr = [1,1,2,3,4,4,5]
const uniqueArr = [...new Set(arr)];
console.log(uniqueArr); //[ 1, 2, 3, 4, 5 ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  方法2
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import _ from 'lodash';
const arr = [1,1,2,3,4,4,5]；
const uniqueArr = _.uniq(arr);
console.log(uniqueArr); //[ 1, 2, 3, 4, 5 ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>求和</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Mon, 06 Sep 2021 07:21:20 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/-3j0m</link>
      <guid>https://dev.to/kongfuboy123/-3j0m</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//将传入的参数转为数组
const turnArray = (...rest)=&amp;gt; [].slice.apply(rest);
//利用reduce对数组求和
const add = arr =&amp;gt; arr.reduce((pre,cur)=&amp;gt;pre+cur);
console.log(add(turnArray(1,2,3,4,5,6)));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>如何解决箭头函数没有arguments</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Mon, 06 Sep 2021 01:26:25 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/arguments-3p45</link>
      <guid>https://dev.to/kongfuboy123/arguments-3p45</guid>
      <description>&lt;p&gt;比如我们想要一个function，可以把传入的参数转成一个数组，传统方法代码如下&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function turnArr(){
  return [].slice.apply(arguments)
}
console.log(turnArr(1,2,3))  // [1,2,3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;但如果我们用箭头函数的形式改写的话，发现就报错了，&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kQpKpP8q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1npw7gcw2aqlp9juqw2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kQpKpP8q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t1npw7gcw2aqlp9juqw2.PNG" alt="Alt Text" width="800" height="368"&gt;&lt;/a&gt;&lt;br&gt;
加个参数进去试试，还是报错&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bEm1F-87--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4b5z5sxw2ewb4q9zfg5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bEm1F-87--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4b5z5sxw2ewb4q9zfg5.PNG" alt="Alt Text" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;为啥不行？原因是箭头函数没有arguments这个类参数数组对象，那么如何解决呢？用&lt;a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Rest_parameters"&gt;剩余参数&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const turnArr = (...arguments) =&amp;gt; [].slice.apply(arguments)
console.log(turnArr(1,2,3)) //[1,2,3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;成功解决了，但是再用这样的写法就啰嗦&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const turnArr1 = (...args) =&amp;gt; args;
console.log(turnArr1(1,2,3)); //[1,2,3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;因为arguments是伪数组，而剩余参数确是货真价实的真数组.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>path.resolve</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Sun, 05 Sep 2021 04:34:46 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/path-resolve-c8</link>
      <guid>https://dev.to/kongfuboy123/path-resolve-c8</guid>
      <description>&lt;h1&gt;
  
  
  path.resolve 用法
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fU80Qgf9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30xq2bg4po7n9d4xmhsv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fU80Qgf9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30xq2bg4po7n9d4xmhsv.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>express.static使用中的一些测试</title>
      <dc:creator>打coding的奥特曼</dc:creator>
      <pubDate>Sun, 05 Sep 2021 04:27:24 +0000</pubDate>
      <link>https://dev.to/kongfuboy123/express-static-36k4</link>
      <guid>https://dev.to/kongfuboy123/express-static-36k4</guid>
      <description>&lt;h1&gt;
  
  
  写一个基本的server.js
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ILcPsKfC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3sxocgsw7a7kzdc7t2o3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ILcPsKfC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3sxocgsw7a7kzdc7t2o3.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
根目录下PUBLIC目录作为静态目录，直接写目录名即可，网页显示如下&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9d5nX6Ad--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80pg497rhf7xra8vrrr7.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9d5nX6Ad--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80pg497rhf7xra8vrrr7.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  测试一
&lt;/h1&gt;

&lt;p&gt;将PUBLIC目录内容复制一份，扔进levelOne子目录，下面我们需要将levelOne作为静态目录.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fVnyE4RS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x938zuf6t28sh0eux0gx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fVnyE4RS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x938zuf6t28sh0eux0gx.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
我们发现如果直接写levelOne目录名，样式丢失了&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kPDKsZ1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eofudmwwwgzvr7rrnsk4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kPDKsZ1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eofudmwwwgzvr7rrnsk4.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
正确的做法是写明levelOne的相对路径了，只写目录名是找不到的&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U1oxpZI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92gfcd11e85lxibjy4jg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U1oxpZI6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92gfcd11e85lxibjy4jg.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  测试2
&lt;/h1&gt;

&lt;p&gt;我们给静态文件加一个虚拟的文件前缀（文件系统中不存在）&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T1i1YSDy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fems20ay69y7zvggrcqi.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T1i1YSDy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fems20ay69y7zvggrcqi.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
如果我们继续访问默认路径localhost:3000,发现样式丢失&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kPDKsZ1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eofudmwwwgzvr7rrnsk4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kPDKsZ1G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eofudmwwwgzvr7rrnsk4.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
正确做法是访问localhost:3000/static路径&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--amfzdlZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6oupvrkmo0km9jr1oj1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--amfzdlZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6oupvrkmo0km9jr1oj1.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
看，样式回来了&lt;br&gt;
所以我建议我们应该顺手把访问路由的路径也加上static，最后代码如下：&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XzRxOqBv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2j5w1zonno603i8lhj9o.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XzRxOqBv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2j5w1zonno603i8lhj9o.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
