会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
gongsikai1
博客园
首页
新随笔
联系
订阅
管理
2025年12月30日
2026全栈面试题(原创)(更新至第44题)
摘要: 1. 实现一个sleep函数一秒后console.log一次 <html> <head> <title>HELLO</title> </head> <body> <h1>HELLO</h1> <script> const sleep = async (seconds) => new Promise(
阅读全文
posted @ 2025-12-30 11:43 龚思凯1
阅读(20)
评论(0)
推荐(0)
2025年12月29日
提升用户体验之条件可见支持切换的图片优化
摘要: 优化前的代码 <template> <p @click="helloFunc" >Hello</p> <div v-if="hello 1" style="background-color: blue;" > <img src="https://placeholder.im/3000x2000.pn
阅读全文
posted @ 2025-12-29 16:45 龚思凯1
阅读(5)
评论(0)
推荐(0)
提升用户体验之线上环境不打印日志
摘要: 将window.console.log置为空函数 if (process.env.NODE_ENV 'production') { window.console.log = () => {}; }
阅读全文
posted @ 2025-12-29 11:30 龚思凯1
阅读(6)
评论(0)
推荐(0)
2025年12月27日
提升用户体验之dns-prefetch和preconnect
摘要: dns-prefetch 只做 1 件事:提前完成「DNS 解析」+ 缓存 <link rel="dns-prefetch" href="https://hello.com"> preconnect 做 3 件事:提前完成「DNS 解析」+「TCP 三次握手」+「TLS 加密协商(HTTPS 场景)
阅读全文
posted @ 2025-12-27 17:00 龚思凯1
阅读(6)
评论(0)
推荐(0)
提升用户体验之async和defer
摘要: async和defer同时出现则只渲染async 以下内容defer最后展示 <html> <head> <script async src="./async.js"></script> <script defer src="./defer.js"></script> <script src="./
阅读全文
posted @ 2025-12-27 15:26 龚思凯1
阅读(5)
评论(0)
推荐(0)
2025年12月25日
提升用户体验之监控页面性能(白屏时间,首屏时间)
摘要: 白屏时间 <script> const observer = new PerformanceObserver((list) => { const entries = list.getEntries(); for (const entry of entries) { if (entry.name 'f
阅读全文
posted @ 2025-12-25 16:56 龚思凯1
阅读(7)
评论(0)
推荐(0)
2025年11月13日
Koa系列教程:1. 创建项目
摘要: 结论 mkdir koa-demo && cd koa-demo npm init -y npm install koa // 1. 引入Koa模块(CommonJS规范,Node.js默认支持) const Koa = require('koa'); // 2. 创建Koa应用实例 const a
阅读全文
posted @ 2025-11-13 17:44 龚思凯1
阅读(39)
评论(0)
推荐(0)
2025年11月11日
React系列教程:10. Button组件示例
摘要: 函数组件 // 复用按钮组件 function Button({ text, onClick, type = "default" }) { const styles = { primary: { backgroundColor: "blue", color: "white" }, default:
阅读全文
posted @ 2025-11-11 17:29 龚思凯1
阅读(9)
评论(0)
推荐(0)
2025年11月10日
Javascript算法系列教程:1. BFS求无向无权图最短路径
摘要: 示例图 BFS示例代码 function bfsShortestPath(graph, start, end) { const queue = [[start]]; const visited = new Set([start]); while (queue.length > 0) { const
阅读全文
posted @ 2025-11-10 17:00 龚思凯1
阅读(37)
评论(0)
推荐(0)
2025年11月7日
React系列教程:9. 空包裹
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 (props) { const [ hello1, setHello1 ] = useState('world1') setTimeo
阅读全文
posted @ 2025-11-07 10:33 龚思凯1
阅读(4)
评论(0)
推荐(0)
下一页
公告