摘要: 结论 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 阅读(6) 评论(0) 推荐(0)
摘要: 函数组件 // 复用按钮组件 function Button({ text, onClick, type = "default" }) { const styles = { primary: { backgroundColor: "blue", color: "white" }, default: 阅读全文
posted @ 2025-11-11 17:29 龚思凯1 阅读(5) 评论(0) 推荐(0)
摘要: 示例图 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 阅读(11) 评论(0) 推荐(0)
摘要: 函数组件 // 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)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 (props) { const [ hello1, setHello1 ] = useState('world1') setTimeo 阅读全文
posted @ 2025-11-05 11:36 龚思凯1 阅读(4) 评论(0) 推荐(0)
摘要: 方式一 let content; if (isLoggedIn) { content = <AdminPanel />; } else { content = <LoginForm />; } return ( <div> {content} </div> ); 方式二 <div> {isLogge 阅读全文
posted @ 2025-11-05 11:26 龚思凯1 阅读(5) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 (props) { const [ hello1, setHello1 ] = useState('world1') setTimeo 阅读全文
posted @ 2025-11-05 11:18 龚思凯1 阅读(3) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 () { const [ hello1, setHello1 ] = useState('world1') setTimeout(() 阅读全文
posted @ 2025-11-04 15:29 龚思凯1 阅读(4) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 () { const [ hello1, setHello1 ] = useState('world1') return ( <div 阅读全文
posted @ 2025-11-04 15:28 龚思凯1 阅读(4) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 () { const [ hello1, setHello1 ] = useState('world1') return ( <div 阅读全文
posted @ 2025-11-04 15:27 龚思凯1 阅读(4) 评论(0) 推荐(0)