<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>lane &#8211; 「马马虎虎」</title>
	<atom:link href="https://www.gek6.cn/author/lane/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.gek6.cn</link>
	<description>极客蜗牛-开发效率很慢的...</description>
	<lastBuildDate>Wed, 22 May 2024 08:06:56 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>

<image>
	<url>https://www.gek6.cn/wp-content/uploads/2021/12/20211205200322145-32x32.png</url>
	<title>lane &#8211; 「马马虎虎」</title>
	<link>https://www.gek6.cn</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>微信图床之浏览器直传</title>
		<link>https://www.gek6.cn/%e5%be%ae%e4%bf%a1%e5%9b%be%e5%ba%8a%e4%b9%8b%e6%b5%8f%e8%a7%88%e5%99%a8%e7%9b%b4%e4%bc%a0/</link>
					<comments>https://www.gek6.cn/%e5%be%ae%e4%bf%a1%e5%9b%be%e5%ba%8a%e4%b9%8b%e6%b5%8f%e8%a7%88%e5%99%a8%e7%9b%b4%e4%bc%a0/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Wed, 22 May 2024 07:40:07 +0000</pubDate>
				<category><![CDATA[未分类]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=219</guid>

					<description><![CDATA[将微信公众号素材库当作图床使用 &#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<blockquote>
<p>将微信公众号素材库当作图床使用</p>
</blockquote>
<h3>第一步服务端获取公众号的access_token</h3>
<pre><code class="language-typescript">async getWechatServiceAccountAccessToken(appid: string, appsecret: string) {
  let accessToken = await this.cacheManager.get(`${appid}_access_token`);
  if (accessToken) {
    return accessToken;
  }
  let res = await axios.get(
    `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&amp;appid=${appid}&amp;secret=${appsecret}`
  );
  console.log(res.data);
  // noinspection SpellCheckingInspection
  if (res.data[&#039;errcode&#039;]) {
    // noinspection SpellCheckingInspection
    throw new Error(res.data[&#039;errmsg&#039;]);
  } else {
    await this.cacheManager.set(
      `${appid}_access_token`,
      res.data[&#039;access_token&#039;],
      {
        ttl: 7000,
      }
    );
    return res.data[&#039;access_token&#039;];
  }
}</code></pre>
<h3>第二部 浏览器端直接传</h3>
<h4>HTML</h4>
<pre><code class="language-html">&lt;el-upload
  action=&quot;#&quot;
  :http-request=&quot;uploadHandler&quot;
  :drag=&quot;true&quot;
  :name=&quot;&#039;media&#039;&quot;
  :show-file-list=&quot;false&quot;
>
  &lt;el-icon&gt;&lt;plus /&gt;&lt;/el-icon&gt;
  &lt;template #tip&gt;
   &lt;div class=&quot;el-upload__tip&quot;&gt;只能上传jpg/png文件，且不超过10MB&lt;/div&gt;
  &lt;/template&gt;
&lt;/el-upload&gt;</code></pre>
<h4>JS</h4>
<pre><code class="language-ts">const uploadActionUrl = computed(() =&gt; {
  return `/wechat-api/cgi-bin/material/add_material?access_token=${wechatAccessToken.value}&amp;type=image`;
});
let wechatAccessToken = ref(&quot;&quot;);
async function uploadHandler({ file }: UploadRequestOptions) {
  console.log(file);
  const formData = new FormData();
  formData.append(&quot;media&quot;, file, file.name);
  let res = await axios.post(uploadActionUrl.value, formData, {});
  console.log(res);
}</code></pre>
<h4>上传截图</h4>
<p><img decoding="async" src="https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/cc724ec3f1644db9ab9168019e3947a5~tplv-k3u1fbpfcp-jj-mark:0:0:0:0:q75.image#?w=959\&amp;h=391\&amp;s=29432\&amp;e=png\&amp;b=fbfbfb" alt="image.png" /></p>
<p><img decoding="async" src="https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/f37cc9a3d05048039bc16ee5725cbfc4~tplv-k3u1fbpfcp-jj-mark:0:0:0:0:q75.image#?w=770\&amp;h=180\&amp;s=18008\&amp;e=png\&amp;b=fdfdfd" alt="image.png" /></p>
<h4>下面这个就是微信素材库的图</h4>
<p><img decoding="async" src="http://mmbiz.qpic.cn/mmbiz_jpg/HEkzn2aI6dBJ3LoqcjDlKynsx7BHMOIN4XR2f0pw07xrlKsaZHDaCQqM5o9nhypGvzWyeIBo0v0MSQVPOgbCTA/0?wx_fmt=jpeg" alt="这个就是微信素材库的图" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e5%be%ae%e4%bf%a1%e5%9b%be%e5%ba%8a%e4%b9%8b%e6%b5%8f%e8%a7%88%e5%99%a8%e7%9b%b4%e4%bc%a0/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>MacOS 14.4.1 无法打开软件提示：i已损坏，无法打开。你应该将它移到废纸篓。</title>
		<link>https://www.gek6.cn/macos-14-4-1-%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80%e8%bd%af%e4%bb%b6%e6%8f%90%e7%a4%ba%ef%bc%9ai%e5%b7%b2%e6%8d%9f%e5%9d%8f%ef%bc%8c%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80%e3%80%82%e4%bd%a0%e5%ba%94/</link>
					<comments>https://www.gek6.cn/macos-14-4-1-%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80%e8%bd%af%e4%bb%b6%e6%8f%90%e7%a4%ba%ef%bc%9ai%e5%b7%b2%e6%8d%9f%e5%9d%8f%ef%bc%8c%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80%e3%80%82%e4%bd%a0%e5%ba%94/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Sun, 28 Apr 2024 02:35:24 +0000</pubDate>
				<category><![CDATA[杂记]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=211</guid>

					<description><![CDATA[先保证系统中 隐私与安全性中 允&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<p>先保证系统中<br />
隐私与安全性中 允许任何来源</p>
<pre><code>sudo spctl --master-disable</code></pre>
<p>完成后检查<br />
<img decoding="async" src="https://www.gek6.cn/wp-content/uploads/2024/04/1714271667214-300x76.jpg" alt="" /></p>
<p>接下来执行下面命令<br />
这里的路径是输入 <code>sudo xattr -cr </code>后在Finder中直接把应用拖拽到终端即可<br />
防止自己手动输入错误</p>
<pre><code>sudo xattr -cr /Applications/Navicat\ Premium.app</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/macos-14-4-1-%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80%e8%bd%af%e4%bb%b6%e6%8f%90%e7%a4%ba%ef%bc%9ai%e5%b7%b2%e6%8d%9f%e5%9d%8f%ef%bc%8c%e6%97%a0%e6%b3%95%e6%89%93%e5%bc%80%e3%80%82%e4%bd%a0%e5%ba%94/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>解决微信公众平台素材库图片防盗链的问题</title>
		<link>https://www.gek6.cn/%e8%a7%a3%e5%86%b3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%b9%b3%e5%8f%b0%e7%b4%a0%e6%9d%90%e5%ba%93%e5%9b%be%e7%89%87%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/%e8%a7%a3%e5%86%b3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%b9%b3%e5%8f%b0%e7%b4%a0%e6%9d%90%e5%ba%93%e5%9b%be%e7%89%87%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Thu, 03 Aug 2023 01:43:48 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=163</guid>

					<description><![CDATA[微信公众号素材引用时提示：此图片&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<p>微信公众号素材引用时提示：此图片来自微信公众平台未经允许不可引用<br />
html模板加上这个属性即可 简单粗暴！</p>
<pre><code>&lt;meta name=&quot;referrer&quot; content=&quot;no-referrer&quot;/&gt;</code></pre>
<p>Referer 头部是一个 HTTP 头部，用于标识请求是从哪个页面发出的。例如，如果你从页面 A 点击一个链接到页面 B，那么在请求页面 B 时，浏览器会发送一个 Referer 头部，值为页面 A 的 URL。</p>
<p>设置了 referrer 策略为 &quot;no-referrer&quot;。这表示浏览器在请求资源时，不会发送 Referer 头部。这意味着目标服务器无法知道请求是从哪个页面发出的。</p>
<p>这个策略在一些情况下可能很有用，例如，当你不希望其他人知道你的页面从哪里链接过来时，或者你不希望把你的页面的 URL 暴露给其他人时。然而，它也可能导致一些问题，因为一些服务可能依赖 Referer 头部来进行防盗链或者跟踪用户行为。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e8%a7%a3%e5%86%b3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%b9%b3%e5%8f%b0%e7%b4%a0%e6%9d%90%e5%ba%93%e5%9b%be%e7%89%87%e9%98%b2%e7%9b%97%e9%93%be%e7%9a%84%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【cool-admin】接口参数校验Joi</title>
		<link>https://www.gek6.cn/%e3%80%90cool-admin%e3%80%91%e6%8e%a5%e5%8f%a3%e5%8f%82%e6%95%b0%e6%a0%a1%e9%aa%8c/</link>
					<comments>https://www.gek6.cn/%e3%80%90cool-admin%e3%80%91%e6%8e%a5%e5%8f%a3%e5%8f%82%e6%95%b0%e6%a0%a1%e9%aa%8c/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Wed, 26 Jul 2023 08:28:19 +0000</pubDate>
				<category><![CDATA[COOL-ADMIN]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=159</guid>

					<description><![CDATA[创建校验类 import { R&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h3>创建校验类</h3>
<pre><code>import { Rule, RuleType } from &#039;@midwayjs/validate&#039;;

export class SendVerifyCodeValidator {
  // 手机号
  @Rule(RuleType.string().label(&#039;手机号&#039;).length(11).required())
  phoneNum: string;
}

export class BindPhoneValidator {
  // 手机号
  @Rule(RuleType.string().label(&#039;手机号&#039;).length(11).required())
  phoneNum: string;
  // 验证码
  @Rule(RuleType.string().label(&#039;验证码&#039;).length(6).required())
  verifyCode: string;
}</code></pre>
<h3>在控制器上加上  <code>@Validate()</code> 即可</h3>
<pre><code>  /**
   * 绑定手机号
   */
  @Post(&#039;/bindPhoneNum&#039;)
  @Validate({
    errorStatus: httpCodeEnum.PARAMS_ERROR,
  })
  async bindPhoneNum(@Body() bindPhoneData: BindPhoneValidator) {
    // TODO 绑定...
    return this.ok(null);
  }</code></pre>
<h1>重点：自定义错误提示语</h1>
<pre><code>  // 验证码
  @Rule(
    RuleType.string().label(&#039;验证码&#039;).length(6).required().messages({
      &#039;string.length&#039;: &#039;{{#label}}位数错误&#039;,
      &#039;string.empty&#039;: &#039;验证码不能为空&#039;,
      &#039;any.required&#039;: &#039;验证码必填&#039;,
    })
  )
  verifyCode: string;</code></pre>
<h3>这么写 是不行的！！</h3>
<h3>需要在这里去定义</h3>
<pre><code>  @Post(&#039;/bindPhoneNum&#039;)
  @Validate({
    errorStatus: httpCodeEnum.PARAMS_ERROR,
    validationOptions: {
      messages: {
      &#039;string.length&#039;: &#039;{{#label}}位数错误&#039;,
      &#039;string.empty&#039;: &#039;{{#label}}不能为空&#039;,
      &#039;any.required&#039;: &#039;{{#label}}必填&#039;,
      },
    },
  })
  async bindPhoneNum(@Body() bindPhoneData: BindPhoneValidator)</code></pre>
<p>但是这样会更改所有字段的对应异常提示<br />
比如这个接口要校验手机号和验证码两个参数<br />
当手机号校验11位未通过，会提示 手机号位数错误<br />
当验证码校验6位未通过，会提示 验证码位数错误</p>
<h3>如果需要自定义验证器 并 提示自定义的异常信息</h3>
<pre><code>  // 验证码校验规则
  @Rule(
    RuleType.string()
      .label(&#039;验证码&#039;)
      .required()
      .custom((value, helpers) =&gt; {
        const reg = /^\d{6}$/;
        if (reg.test(value)) {
          return value;
        }
        throw new Error(&#039;格式错误&#039;);
      })
  )
  verifyCode: string;

  // 控制器中校验装饰器
  @Validate({
    errorStatus: httpCodeEnum.PARAMS_ERROR,
    validationOptions: {
      messages: {
        &#039;any.custom&#039;: &#039;{{#label}}{{#error.message}}&#039;,
      },
    },
  })

  // 最终响应
  {&quot;code&quot;:5001,&quot;message&quot;:&quot;\&quot;验证码\&quot;格式错误&quot;}
</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/%e3%80%90cool-admin%e3%80%91%e6%8e%a5%e5%8f%a3%e5%8f%82%e6%95%b0%e6%a0%a1%e9%aa%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Electron打包采坑</title>
		<link>https://www.gek6.cn/electron%e6%89%93%e5%8c%85%e9%87%87%e5%9d%91/</link>
					<comments>https://www.gek6.cn/electron%e6%89%93%e5%8c%85%e9%87%87%e5%9d%91/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Tue, 04 Jul 2023 07:13:18 +0000</pubDate>
				<category><![CDATA[Electron]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=155</guid>

					<description><![CDATA[安装过程中 会需要 python&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h4>安装过程中 会需要 <code>python2.7</code> 等待自动安装即可</h4>
<h4>安装 <code>windows-build-tools</code></h4>
<pre><code class="language-bash">npm install windows-build-tools</code></pre>
<h5>安装 <code>windows-build-tools</code> 后 再次打包 会下载对应操作系统的打包插件</h5>
<p>0.SHASUMS256.txt-2.0.18<br />
1.electron-v2.0.18-win32-x64.zip  淘宝镜像下载地址https://npm.taobao.org/mirrors/electron/<br />
2.winCodeSign-2.4.0.7z<br />
3.nsis-3.0.1.13.7z<br />
4.nsis-resources-3.0.7z<br />
5.app-builder-v0.6.1-x64.7z</p>
<h5>最终文件夹如下：</h5>
<pre><code>--electron  
    C:\Users\windows用户\AppData\Local\electron\
    --Cache
        electron-v2.0.18-win32-x64.zip
        SHASUMS256.txt-2.0.18
--electron-builder
    C:\Users\windows用户\AppData\Local\electron-builder\cache\
    --cache
        --app-builder
            --app-builder-v0.6.1-x64
                解压app-builder-v0.6.1-x64.7z所得文件
        --nsis
            --nsis-3.0.1.13
                解压nsis-3.0.1.13.7z所得文件
        --nsis-resources
            --nsis-resources-3.3.0
                解压nsis-resources-3.3.0.7z所得文件
        --winCodeSign
            --winCodeSign-2.4.0
                解压winCodeSign-2.4.0.7z所得文件</code></pre>
<p><img decoding="async" src="https://foruda.gitee.com/images/1687833169913255483/63cb2ac7_1999285.png" alt="目录截图" title="11111111.png" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/electron%e6%89%93%e5%8c%85%e9%87%87%e5%9d%91/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CSS实现单行、多行文本溢出显示省略号</title>
		<link>https://www.gek6.cn/css%e5%ae%9e%e7%8e%b0%e5%8d%95%e8%a1%8c%e3%80%81%e5%a4%9a%e8%a1%8c%e6%96%87%e6%9c%ac%e6%ba%a2%e5%87%ba%e6%98%be%e7%a4%ba%e7%9c%81%e7%95%a5%e5%8f%b7/</link>
					<comments>https://www.gek6.cn/css%e5%ae%9e%e7%8e%b0%e5%8d%95%e8%a1%8c%e3%80%81%e5%a4%9a%e8%a1%8c%e6%96%87%e6%9c%ac%e6%ba%a2%e5%87%ba%e6%98%be%e7%a4%ba%e7%9c%81%e7%95%a5%e5%8f%b7/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Tue, 04 Jul 2023 07:12:08 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=153</guid>

					<description><![CDATA[单行 overflow: hid&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h5>单行</h5>
<pre><code>overflow: hidden;

text-overflow:ellipsis;

white-space: nowrap;
</code></pre>
<h5>多行</h5>
<pre><code>display: -webkit-box;

-webkit-box-orient: vertical;

-webkit-line-clamp: 3;

overflow: hidden;</code></pre>
<h5>适用范围：</h5>
<blockquote>
<p>因使用了WebKit的CSS扩展属性，该方法适用于WebKit浏览器及移动端；</p>
</blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/css%e5%ae%9e%e7%8e%b0%e5%8d%95%e8%a1%8c%e3%80%81%e5%a4%9a%e8%a1%8c%e6%96%87%e6%9c%ac%e6%ba%a2%e5%87%ba%e6%98%be%e7%a4%ba%e7%9c%81%e7%95%a5%e5%8f%b7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Cool-Admin 开启跨域问题</title>
		<link>https://www.gek6.cn/cool-admin-%e5%bc%80%e5%90%af%e8%b7%a8%e5%9f%9f%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/cool-admin-%e5%bc%80%e5%90%af%e8%b7%a8%e5%9f%9f%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Tue, 04 Jul 2023 07:11:37 +0000</pubDate>
				<category><![CDATA[COOL-ADMIN]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=151</guid>

					<description><![CDATA[// /src/configur&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<pre><code>// /src/configuration.ts
import * as crossDomain from &#039;@midwayjs/cross-domain&#039;;
@Configuration({
  imports: [
    crossDomain,
  ],
  importConfigs: [join(__dirname, &#039;./config&#039;)],
})</code></pre>
<pre><code>// /src/config/config.default.ts

export default {
  cors: {
    // 允许跨域的方法，【默认值】为 GET,HEAD,PUT,POST,DELETE,PATCH
    allowMethods: &#039;*&#039;,
    // 设置 Access-Control-Allow-Origin 的值，【默认值】会获取请求头上的 origin
    // 也可以配置为一个回调方法，传入的参数为 request，需要返回 origin 值
    // 例如：http://test.midwayjs.org
    // 如果设置了 credentials，则 origin 不能设置为 *
    origin: &#039;*&#039;,
    // 设置 Access-Control-Allow-Headers 的值，【默认值】会获取请求头上的 Access-Control-Request-Headers
    allowHeaders: &#039;*&#039;,
    // 设置 Access-Control-Expose-Headers 的值
    exposeHeaders: &#039;*&#039;,
    // 设置 Access-Control-Allow-Credentials，【默认值】false
    // 也可以配置为一个回调方法，传入的参数为 request，返回值为 true 或 false
    credentials: false,
    // 是否在执行报错的时候，把跨域的 header 信息写入到 error 对的 headers 属性中，【默认值】false
    keepHeadersOnError: true,
    // 设置 Access-Control-Max-Age
    maxAge: 36000,
  },
}
</code></pre>
<h1>重点！后台管理的接口报错，经过排查是因为对 OPTIONS 请求未做特殊响应</h1>
<p><img decoding="async" src="https://foruda.gitee.com/images/1687833639383824912/a12f734e_1999285.png" alt="后台登录权鉴中间件修改" title="未命名1687833597.png" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/cool-admin-%e5%bc%80%e5%90%af%e8%b7%a8%e5%9f%9f%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>nvm安装Node16.x 使用npm安装任何依赖报错语法错误的问题</title>
		<link>https://www.gek6.cn/nvm%e5%ae%89%e8%a3%85node16-x-%e4%bd%bf%e7%94%a8npm%e5%ae%89%e8%a3%85%e4%bb%bb%e4%bd%95%e4%be%9d%e8%b5%96%e6%8a%a5%e9%94%99%e8%af%ad%e6%b3%95%e9%94%99%e8%af%af%e7%9a%84%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/nvm%e5%ae%89%e8%a3%85node16-x-%e4%bd%bf%e7%94%a8npm%e5%ae%89%e8%a3%85%e4%bb%bb%e4%bd%95%e4%be%9d%e8%b5%96%e6%8a%a5%e9%94%99%e8%af%ad%e6%b3%95%e9%94%99%e8%af%af%e7%9a%84%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Tue, 04 Jul 2023 07:11:08 +0000</pubDate>
				<category><![CDATA[NodeJS]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=149</guid>

					<description><![CDATA[报错信息： npm ERR!Un&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<p>报错信息：</p>
<pre><code>npm ERR!Unexpected token &#039;.&#039;</code></pre>
<h3>解决方案：</h3>
<ol>
<li>升级nvm版本 <a href="https://github.com/coreybutler/nvm-windows/releases">GitHub下载地址</a></li>
<li>卸载需要用的Node版本，再安装一遍即可
<ul>
<li><code>nvm uninstall 16.18.0</code></li>
<li><code>nvm install 16.18.0</code></li>
<li><code>nvm use 16.18.0</code></li>
</ul>
</li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/nvm%e5%ae%89%e8%a3%85node16-x-%e4%bd%bf%e7%94%a8npm%e5%ae%89%e8%a3%85%e4%bb%bb%e4%bd%95%e4%be%9d%e8%b5%96%e6%8a%a5%e9%94%99%e8%af%ad%e6%b3%95%e9%94%99%e8%af%af%e7%9a%84%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>IOS12.X 微信小程序样式错乱问题</title>
		<link>https://www.gek6.cn/ios12-x-%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%a0%b7%e5%bc%8f%e9%94%99%e4%b9%b1%e9%97%ae%e9%a2%98/</link>
					<comments>https://www.gek6.cn/ios12-x-%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%a0%b7%e5%bc%8f%e9%94%99%e4%b9%b1%e9%97%ae%e9%a2%98/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Wed, 03 Aug 2022 06:45:19 +0000</pubDate>
				<category><![CDATA[小程序]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=123</guid>

					<description><![CDATA[嵌套flex布局引起]]></description>
										<content:encoded><![CDATA[<h2>嵌套flex布局引起</h2>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/ios12-x-%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%a0%b7%e5%bc%8f%e9%94%99%e4%b9%b1%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>vue3+vite自动加载路由</title>
		<link>https://www.gek6.cn/vue3vite%e8%87%aa%e5%8a%a8%e5%8a%a0%e8%bd%bd%e8%b7%af%e7%94%b1/</link>
					<comments>https://www.gek6.cn/vue3vite%e8%87%aa%e5%8a%a8%e5%8a%a0%e8%bd%bd%e8%b7%af%e7%94%b1/#respond</comments>
		
		<dc:creator><![CDATA[lane]]></dc:creator>
		<pubDate>Fri, 29 Jul 2022 02:54:52 +0000</pubDate>
				<category><![CDATA[Vue]]></category>
		<guid isPermaLink="false">https://www.gek6.cn/?p=108</guid>

					<description><![CDATA[1、使用 import.meta&#46;&#46;&#46;]]></description>
										<content:encoded><![CDATA[<h3>1、使用 <code>import.meta.glob</code>加载所有vue文件</h3>
<pre><code>const modules = import.meta.glob(&quot;../views/**/*.vue&quot;);
let autoRoutes: Route[] = [];
for (let key in modules) {
  console.log(key);
  autoRoutes.push({
    filePath: key,
    path: key.replace(&quot;../views/&quot;, &quot;/&quot;).replace(&quot;.vue&quot;, &quot;&quot;),
    component: modules[key]
  });
}</code></pre>
<h3>2、使用<code>addRoute</code>挂载动态路由</h3>
<pre><code>const mountRoutes = async () =&gt; {
  for (const item of autoRoutes) {
    if (item.path) {
      const route = {
        path: item.path,
        component: () =&gt; import(item.filePath)
      };
      console.log(route);
      router.addRoute(route);
    }
  }
};</code></pre>
<h3>3、路由配置</h3>
<pre><code>import { createRouter, createWebHashHistory } from &quot;vue-router&quot;;
import indexPage from &quot;../views/index/index.vue&quot;;
import { mountRoutes } from &quot;./auto-load&quot;;
import { getToken } from &quot;../utils/token&quot;;

const routes = [
  { path: &quot;/&quot;, component: indexPage },
  { path: &quot;/login&quot;, component: () =&gt; import(&quot;../views-common/account/login/index.vue&quot;) }
];
export const router = createRouter({
  history: createWebHashHistory(),
  routes
});

const authWhiteList = [
  &quot;/login&quot;
];
// 是否已经挂载动态路由标识
let routeHasMounted = false;
router.beforeEach(async (to, from, next) =&gt; {
  // 是否为免登录白名单 是的话直接放行
  if (authWhiteList.includes(to.path)) {
    next();
  } else {
    // 需要免登录的页面 判断是否已经登录
    if (!getToken()) {
      // 未登录的直接跳转到登录页面
      next({ path: &quot;/login&quot;, replace: true });
    } else {
      // 已经登录的 判断是否挂载动态路由
      if (!routeHasMounted) {
        // 未挂载状态 挂载动态路由
        await mountRoutes();
        // 将挂载状态设置为true
        routeHasMounted = true;
        // 重新路由到当前页面 因为此页面在第一次打开的时候是 匹配不到路由的
        // 这里replace: true 是为了让网页不能返回上一页
        next({ ...to, replace: true });
      } else {
        // 已经挂载状态 直接放行
        next();
      }
    }
  }
});
</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.gek6.cn/vue3vite%e8%87%aa%e5%8a%a8%e5%8a%a0%e8%bd%bd%e8%b7%af%e7%94%b1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
