<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel>
<title>前端集合 - 关注前端技术和互联网免费资源</title>
<link>https://www.geek100.com/</link>
<atom:link href="https://geek100.com/feed/" rel="self" type="application/rss+xml" />
<language>zh-CN</language>
<description>关注前端技术和互联网免费资源</description>
<lastBuildDate>Sun, 15 Mar 2026 09:25:00 +0800</lastBuildDate>
<pubDate>Sun, 15 Mar 2026 09:25:00 +0800</pubDate>
<item>
<title>免费 API 邮件发送服务对比</title>
<link>https://geek100.com/3300.html</link>
<guid>https://geek100.com/3300.html</guid>
<pubDate>Sun, 15 Mar 2026 09:25:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[技巧应用]]></category>
<description><![CDATA[resend3,000 emails / mo — 每月 3000 封邮件Sending & Receiving — 发送与接收Ticket support — 工单支持1-day Data R...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h3>resend</h3><ul><li>3,000 emails / mo — 每月 3000 封邮件</li><li>Sending & Receiving — 发送与接收</li><li>Ticket support — 工单支持</li><li>1-day Data Retention — 数据保留 1 天</li><li>1 Domain — 1 个域名</li></ul><h3>sendflare</h3><ul><li>Up to 2 domains — 最多 2 个域名</li><li>3,000 emails a month — 每月 3000 封邮件</li><li>30-day Data Retention — 数据保留 30 天</li><li>1,000 contacts — 1000 个联系人</li><li>RESTful email APIs — RESTful 邮件 API</li></ul><h3>Mailgun</h3><ul><li>3,000 emails per month, 100 per day — 每月 3000 封，每日 100 封</li><li>1 sending domain — 1 个发信域名</li><li>1 API key — 1 个 API 密钥</li><li>1 day log retention to track the email sending process — 日志保留 1 天，用于追踪邮件发送流程</li><li>1 route to parse inbound messages — 1 条路由，用于解析入站邮件</li><li>Ticket support — 工单支持</li></ul><p>这几个都可以。<br>需要注意的是：Mailgun 需要短信验证码验证，我一直没收到短信验证码。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3300.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3300.html</wfw:commentRss>
</item>
<item>
<title>通过 WordPress rest api 更新 Advanced Custom Fields 字段时为什么会失败 ( 接口返回 acf: false )?</title>
<link>https://geek100.com/3288.html</link>
<guid>https://geek100.com/3288.html</guid>
<pubDate>Wed, 10 Dec 2025 21:04:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[这个问题困扰了我好几天，网上找了很多答案都行不通，问了一些 ai 也没解决。最后还是查到了解决方案。问题表现不管是使用 js 代码还是通过 postman 这种工具，通过 WordPress r...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>这个问题困扰了我好几天，网上找了很多答案都行不通，问了一些 ai 也没解决。</p><p>最后还是查到了解决方案。</p><h3>问题表现</h3><p>不管是使用 js 代码还是通过 postman 这种工具，通过 WordPress rest api 创建或更新文章时，提交的 acf 相关字段明明有值，但是在后台全部都是空，即使我已经开始了 Advanced Custom Fields 相关字段的 Show in REST API 设置。</p><h3>问题原因</h3><p>既不是代码写得有问题，也不是权限问题，更不是网上说的不应该直接用字段名而应该用（Field Key）标签（后面跟着一串以 field_ 开头的字符串（例如：field_6578abc123def））这种说法。</p><p>真实的原因就是通过 WordPress rest api 不能直接修改 Advanced Custom Fields 的字段，只能读取。</p><p>所以要把这个限制解开。方法如下：</p><h3>解决方案</h3><pre><code class="lang-php">// 1. 让 ACF 字段出现在 REST API 响应中（读取）
function add_acf_to_rest_response($data, $post, $context) {
    // 方式A：添加所有 ACF 字段
    $data-&gt;data['acf'] = get_fields($post-&gt;ID);
    // 方式B：只添加指定字段（推荐，减少数据量）
    // $data-&gt;data['acf'] = [
    //     'article_subtitle' =&gt; get_field('article_subtitle', $post-&gt;ID),
    //     'article_views' =&gt; get_field('article_views', $post-&gt;ID)
    // ];
    return $data;
}
add_filter('rest_prepare_post', 'add_acf_to_rest_response', 10, 3);

// 2. 允许通过 REST API 更新 ACF 字段（写入）
function update_acf_via_rest($post, $request) {
    // 验证权限：只有能编辑文章的用户才能更新
    if (!current_user_can('edit_post', $post-&gt;ID)) {
        return $post;
    }

    // 获取请求中的 ACF 数据（核心：从 request 中提取 acf 节点）
    $acf_data = $request-&gt;get_param('acf');
    
    // 仅当 acf 数据存在且为数组时更新
    if (!empty($acf_data) &amp;&amp; is_array($acf_data)) {
        foreach ($acf_data as $field_name =&gt; $field_value) {
            // 使用 ACF 官方函数更新字段（自动验证字段类型）
            update_field($field_name, $field_value, $post-&gt;ID);
        }
    }

    return $post;
}
// 绑定到「更新文章」和「创建文章」的钩子
add_action('rest_after_update_post', 'update_acf_via_rest', 10, 2);
add_action('rest_after_insert_post', 'update_acf_via_rest', 10, 2);</code></pre><p>通过以上设置，再次更新，WordPress 后台的 Advanced Custom Fields 相关字段 <strong>100%</strong> 有值了。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3288.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3288.html</wfw:commentRss>
</item>
<item>
<title>pnpm 和 yarn 文件清理</title>
<link>https://geek100.com/3276.html</link>
<guid>https://geek100.com/3276.html</guid>
<pubDate>Thu, 29 May 2025 21:10:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[IT新旧闻]]></category>
<description><![CDATA[公司的 Macbook pro 只有 256G 硬盘，越来越捉襟见肘。清理了下 node_modules 后，空间多出来了十几个G。pnpm查看存储目录pnpm store path清理未使用包...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>公司的 Macbook pro 只有 256G 硬盘，越来越捉襟见肘。</p><p>清理了下 node_modules 后，空间多出来了十几个G。</p><h3>pnpm</h3><ul><li><p>查看存储目录</p><pre><code class="lang-shell">pnpm store path</code></pre></li><li><p>清理未使用包</p><pre><code class="lang-shell">pnpm store prune</code></pre></li></ul><h3>yarn</h3><ul><li><p>清理全局安装目录</p><pre><code class="lang-shell">yarn global dir</code></pre></li><li><p>查看缓存目录（需手动删除清理）</p><pre><code class="lang-shell">yarn cache dir</code></pre></li></ul>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3276.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3276.html</wfw:commentRss>
</item>
<item>
<title>React native iOS app No script URL provided 报错的解决方案</title>
<link>https://geek100.com/3270.html</link>
<guid>https://geek100.com/3270.html</guid>
<pubDate>Fri, 25 Apr 2025 08:15:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[React native iOS app安装成功，但是到最后一步打开 app 是提示如下错误：No script URL provided. Make sure the packager is ...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>React native iOS app安装成功，但是到最后一步打开 app 是提示如下错误：</p><p><img src="https://www.geek100.com/usr/uploads/2025/04/1245803417.png" alt="410836762-81cc9b37-5158-4f66-afaa-b89ed1104faa.png" title="410836762-81cc9b37-5158-4f66-afaa-b89ed1104faa.png"></p><blockquote>No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.<br>unsanitizedScriptURLString = (null)</blockquote><h3>解决方案</h3><p>如果是 mac os，在终端 vi /etc/hosts，添加如下行：</p><pre><code class="lang-shell">127.0.0.1 localhost</code></pre><p>windows 系统操作步骤类似。</p><p>即可解决问题。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3270.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3270.html</wfw:commentRss>
</item>
<item>
<title>Taro react native 报错 stylelint-taro-rn 找不到文件 stylelint\lib\utils\declarationValueIndex.cjs 的解决方案</title>
<link>https://geek100.com/3269.html</link>
<guid>https://geek100.com/3269.html</guid>
<pubDate>Tue, 22 Apr 2025 08:39:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[近期用 Taro 4.x 版本开发 react native 时遇到如上报错，解决方案如下：package.json 添加 如下配置&quot;resolutions&quot;: { &quo...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>近期用 Taro 4.x 版本开发 react native 时遇到如上报错，解决方案如下：</p><h3>package.json 添加 如下配置</h3><pre><code class="lang-json">&quot;resolutions&quot;: { &quot;stylelint&quot;: &quot;~16.10.0&quot; }</code></pre><h3>dev 依赖修改</h3><p>stylelint 版本改为如下：</p><pre><code class="lang-json">&quot;stylelint&quot;: &quot;~16.10.0&quot;
</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3269.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3269.html</wfw:commentRss>
</item>
<item>
<title>Mac OS idleassetd 进程占用大量网络流量怎么办？</title>
<link>https://geek100.com/3268.html</link>
<guid>https://geek100.com/3268.html</guid>
<pubDate>Sat, 19 Apr 2025 10:05:32 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[idleassetd 一直以十几兆的速度在下载，把网络都快给堵塞了，导致打开啥网页都慢。1招解决问题：修改文件进入finder 文件夹 /Library/Application Support/...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>idleassetd 一直以十几兆的速度在下载，把网络都快给堵塞了，导致打开啥网页都慢。1招解决问题：</p><h3>修改文件</h3><p>进入finder 文件夹 /Library/Application Support/com.apple.idleassetsd/Customer/ ，找到 entries.json 文件，将其内容改为：</p><pre><code class="lang-json">{&quot;version&quot;:1,&quot;localizationVersion&quot;:&quot;21J-1&quot;,&quot;assets&quot;:[],&quot;initialAssetCount&quot;:4,&quot;categories&quot;:[]}</code></pre><p>如提示没权限，请先创建好文件，再复制进去。</p><p>Ok，流量恢复正常。</p><blockquote><p>删除文件节省硬盘空间</p><p>进入 /Library/Application Support/com.apple.idleassetsd/ ，删除 4KSDR240FPS 整个文件夹，硬盘空间瞬间多出几十G。</p></blockquote>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3268.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3268.html</wfw:commentRss>
</item>
<item>
<title>JavaScript: Base64 数据分片切割</title>
<link>https://geek100.com/3267.html</link>
<guid>https://geek100.com/3267.html</guid>
<pubDate>Sat, 12 Apr 2025 11:45:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[在网上找了很多 base64 切割分片的方法，都有各种各样的问题，最后结合各种方案和测试，得到一个较为完美的方案，未发现bug：实现export default {    /**     * @...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>在网上找了很多 base64 切割分片的方法，都有各种各样的问题，最后结合各种方案和测试，得到一个较为完美的方案，未发现bug：</p><h3>实现</h3><pre><code class="lang-javascript">export default {
    /**
     * @param {string} baseStr - base64 字符
     * @param {number} sizeByte - 分片目标字节大小
     * @returns {string[]} 返回切割后 base64 字符串数组
     */
    split(baseStr, sizeByte) {
        if (!baseStr) return [];

        // 计算base64字符数，确保是4的倍数
        let base64Size = Math.ceil((sizeByte * 4) / 3);
        base64Size = Math.ceil(base64Size / 4) * 4;

        let result = [];
        let matches = baseStr.match(/^data:(.+);base64,(.+)$/);
        let prefix = '';
        let lastData = baseStr;

        // 处理data URL格式
        if (matches) {
            prefix = matches[1];
            lastData = matches[2];
        }

        for (let i = 0; i &lt; lastData.length; i += base64Size) {
            let part = lastData.slice(i, i + base64Size);

            // 如果不是最后一块，确保长度是4的倍数
            if (i + base64Size &lt; lastData.length) {
                while (part.length % 4 !== 0) {
                    part += '=';
                }
            }

            // 如果是data URL格式，添加前缀
            if (matches &amp;&amp; i === 0) {
                part = `data:${prefix};base64,${part}`;
            }

            result.push(part);
        }

        return result;
    },

    /**
     * 按兆字节（MB）大小分割 base64 字符串
     * @param {string} baseStr - base64
     * @param {number} mbSize - 分片目标字节大小
     * @returns {string[]} 返回切割后 base64 字符串数组
     */
    cut(baseStr, mbSize) {
        if (!baseStr || mbSize &lt;= 0) return [];

        // 计算目标字节大小
        const targetByte = mbSize * 1024 * 1024;

        // base64 编码会将 3 字节数据编码为 4 字节
        // 因此需要调整分片大小以适应 base64 编码
        const base64PartSize = Math.floor(targetByte * 3 / 4);

        return this.split(baseStr, base64PartSize);
    }
}</code></pre><h3>调用</h3><pre><code class="lang-javascript">// 按 1 兆进行分片切割
cut('data:image/png;base64,/9j/4AAQSkZJRgABAQAAA...', 1)</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3267.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3267.html</wfw:commentRss>
</item>
<item>
<title>Nuxt.js 3 如何开启 autoprefixer 自动补全 css 浏览器前缀？</title>
<link>https://geek100.com/3254.html</link>
<guid>https://geek100.com/3254.html</guid>
<pubDate>Tue, 20 Aug 2024 22:07:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[第一步在根目录 package.json 加入：里面的内容也可以去网上查询，自己自定义。&quot;browserslist&quot;: [    &quot;&gt; 1%&quot;,  ...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<h3>第一步</h3><p>在根目录 package.json 加入：</p><p>里面的内容也可以去网上查询，自己自定义。</p><pre><code class="lang-json">&quot;browserslist&quot;: [
    &quot;&gt; 1%&quot;,
    &quot;not dead&quot;,
    &quot;last 3 version&quot;,
    &quot;Chrome &gt;= 60&quot;,
    &quot;Edge &gt;= 15&quot;,
    &quot;Safari &gt;= 10&quot;,
    &quot;Firefox &gt;= 54&quot;,
    &quot;Opera &gt;= 38&quot;,
    &quot;iOS &gt;= 10&quot;,
    &quot;Android &gt;= 5&quot;,
    &quot;not IE &lt;= 11&quot;
  ]</code></pre><h3>第二步安装</h3><pre><code class="lang-shell">npm install postcss-preset-env --save-dev</code></pre><h3>第三步配置</h3><p>在 nuxt.config.ts 加入如下配置：</p><pre><code class="lang-json">postcss: {
    plugins: {
      'postcss-preset-env': {
        autoprefixer: {},
      },
    },
},</code></pre><p>随便在 css 里写个 display: flex, 即可看到补全后的效果：</p><pre><code class="lang-css">display: -webkit-box;
display: -ms-flexbox;
display: flex;</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3254.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3254.html</wfw:commentRss>
</item>
<item>
<title>1Panel和宝塔面板内存占用情况对比</title>
<link>https://geek100.com/3251.html</link>
<guid>https://geek100.com/3251.html</guid>
<pubDate>Sat, 27 Jul 2024 19:46:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[4 个 PHP 站点和 1 个 Node.js 站点，同一个服务器同配置，每个站点都基本没啥访问量：1Panel 平均占用内存 1.1G - 1.2G 之间；宝塔平均占用内存 700 - 800...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>4 个 PHP 站点和 1 个 Node.js 站点，同一个服务器同配置，每个站点都基本没啥访问量：</p><p>1Panel 平均占用内存 1.1G - 1.2G 之间；<br>宝塔平均占用内存 700 - 800 Mb 之间；</p><p>差别还是挺大的。</p><p>对于小内存的服务器还是老老实实用宝塔吧。</p>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3251.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3251.html</wfw:commentRss>
</item>
<item>
<title>如何在 Nuxt 3 中集成 tdesign-vue-next UI 组件库？</title>
<link>https://geek100.com/3236.html</link>
<guid>https://geek100.com/3236.html</guid>
<pubDate>Mon, 26 Feb 2024 23:25:00 +0800</pubDate>
<dc:creator>前端集合</dc:creator>
<category><![CDATA[经验记录]]></category>
<description><![CDATA[网上的教程要么太复杂，要么有错误。拿目前最新的 tdesign-vue-next 1.8.x 版本来说，将其集成到 nuxt.js 3 里，其实很容易。请看代码：// nuxt.config.t...]]></description>
<content:encoded xml:lang="zh-CN"><![CDATA[
<p>网上的教程要么太复杂，要么有错误。</p><p>拿目前最新的 tdesign-vue-next 1.8.x 版本来说，将其集成到 nuxt.js 3 里，其实很容易。请看代码：</p><pre><code class="lang-javascript">// nuxt.config.ts 文件
export default defineNuxtConfig({
  devtools: { enabled: true },
  
  // 添加tdesign配置
  build: {
    transpile: ['tdesign-vue-next'],
  },
  modules: [
    // 添加tdesign配置
    'tdesign-vue-next/es/nuxt',
  ],
})</code></pre>
]]></content:encoded>
<slash:comments>0</slash:comments>
<comments>https://geek100.com/3236.html#comments</comments>
<wfw:commentRss>https://geek100.com/feed/3236.html</wfw:commentRss>
</item>
</channel>
</rss>