{"id":41,"date":"2026-02-17T18:57:43","date_gmt":"2026-02-17T10:57:43","guid":{"rendered":"https:\/\/word.ronrin.cn\/?p=41"},"modified":"2026-02-17T19:01:33","modified_gmt":"2026-02-17T11:01:33","slug":"react-%e7%bb%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/word.ronrin.cn\/index.php\/2026\/02\/17\/react-%e7%bb%84%e4%bb%b6\/","title":{"rendered":"React \u7ec4\u4ef6"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>\u91cd\u5199\u4e3a React \u7ec4\u4ef6<\/strong> \u2014 \u539f\u6765\u7684 artifact \u662f HTML \u683c\u5f0f\uff0c\u5b58\u5728\u8bed\u6cd5\u89e3\u6790\u9519\u8bef\uff0c\u73b0\u5728\u6539\u4e3a React \u7ec4\u4ef6\uff0c\u66f4\u7a33\u5b9a <strong>\u5185\u7f6e\u5bcc\u6587\u672c\u7f16\u8f91\u5668<\/strong> \u2014 \u4f7f\u7528 <code>contentEditable<\/code> \u5b9e\u73b0\uff0c\u652f\u6301\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u52a0\u7c97 \/ \u659c\u4f53 \/ \u4e0b\u5212\u7ebf<\/strong><\/li>\n\n\n\n<li><strong>H1 \/ H2 \u6807\u9898<\/strong><\/li>\n\n\n\n<li><strong>\u5de6\u5bf9\u9f50 \/ \u5c45\u4e2d<\/strong><\/li>\n\n\n\n<li><strong>\u6709\u5e8f \/ \u65e0\u5e8f\u5217\u8868<\/strong><\/li>\n\n\n\n<li><strong>\u64a4\u9500 \/ \u91cd\u505a<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u65e0\u9700 API Key<\/strong> \u2014 \u4e0d\u4f9d\u8d56 TinyMCE \u5916\u90e8CDN\uff0c\u76f4\u63a5\u53ef\u7528<br><br><br>import { useState, useEffect, useRef } from &#8220;react&#8221;; const CATEGORIES = [&#8220;\u79d1\u6280&#8221;, &#8220;\u73af\u4fdd&#8221;, &#8220;\u7ecf\u6d4e&#8221;, &#8220;\u793e\u4f1a&#8221;, &#8220;\u6587\u5316&#8221;, &#8220;\u4f53\u80b2&#8221;]; const initArticles = [ { id: 1, title: &#8220;\u79d1\u6280\u521b\u65b0\u63a8\u52a8\u4ea7\u4e1a\u5347\u7ea7&#8221;, content: &#8220;&lt;p>\u968f\u7740\u4eba\u5de5\u667a\u80fd\u3001\u5927\u6570\u636e\u7b49\u65b0\u6280\u672f\u7684\u4e0d\u65ad\u53d1\u5c55\uff0c\u4f20\u7edf\u5236\u9020\u4e1a\u6b63\u5728\u7ecf\u5386\u6df1\u523b\u7684\u6570\u5b57\u5316\u8f6c\u578b\u3002\u4f01\u4e1a\u901a\u8fc7\u5f15\u5165\u667a\u80fd\u5236\u9020\u6280\u672f\uff0c\u4e0d\u4ec5\u63d0\u9ad8\u4e86\u751f\u4ea7\u6548\u7387\uff0c\u8fd8\u964d\u4f4e\u4e86\u8fd0\u8425\u6210\u672c\u3002&lt;\/p>&lt;p>\u4e13\u5bb6\u9884\u6d4b\uff0c\u672a\u6765\u5341\u5e74\u5c06\u662f\u6570\u5b57\u5316\u8f6c\u578b\u7684\u5173\u952e\u671f\u3002&lt;\/p>&#8221;, author: &#8220;\u5f20\u4e09&#8221;, category: &#8220;\u79d1\u6280&#8221;, tags: &#8220;\u4eba\u5de5\u667a\u80fd,\u6570\u5b57\u5316\u8f6c\u578b&#8221;, date: new Date().toISOString(), }, { id: 2, title: &#8220;\u73af\u4fdd\u65b0\u653f\u7b56\u52a9\u529b\u7eff\u8272\u53d1\u5c55&#8221;, content: &#8220;&lt;p>\u56fd\u5bb6\u51fa\u53f0\u7cfb\u5217\u73af\u4fdd\u653f\u7b56\uff0c\u9f13\u52b1\u4f01\u4e1a\u91c7\u7528\u6e05\u6d01\u80fd\u6e90\uff0c\u63a8\u52a8\u7eff\u8272\u4f4e\u78b3\u53d1\u5c55\u3002\u65b0\u653f\u7b56\u5305\u62ec\u78b3\u6392\u653e\u4ea4\u6613\u3001\u7eff\u8272\u91d1\u878d\u652f\u6301\u3001\u6e05\u6d01\u80fd\u6e90\u8865\u8d34\u7b49\u591a\u9879\u63aa\u65bd\u3002&lt;\/p>&#8221;, author: &#8220;\u674e\u56db&#8221;, category: &#8220;\u73af\u4fdd&#8221;, tags: &#8220;\u73af\u4fdd\u653f\u7b56,\u6e05\u6d01\u80fd\u6e90&#8221;, date: new Date(Date.now() &#8211; 86400000).toISOString(), }, ]; function RichEditor({ value, onChange }) { const ref = useRef(null); const skip = useRef(false); useEffect(() => { if (ref.current &amp;&amp; !skip.current) { ref.current.innerHTML = value || &#8220;&#8221;; } skip.current = false; }, [value]); const exec = (cmd, val) => { ref.current.focus(); document.execCommand(cmd, false, val || null); skip.current = true; onChange(ref.current.innerHTML); }; const tools = [ { label: &#8220;B&#8221;, cmd: &#8220;bold&#8221;, s: { fontWeight: &#8220;bold&#8221; } }, { label: &#8220;I&#8221;, cmd: &#8220;italic&#8221;, s: { fontStyle: &#8220;italic&#8221; } }, { label: &#8220;U&#8221;, cmd: &#8220;underline&#8221;, s: { textDecoration: &#8220;underline&#8221; } }, { label: &#8220;H1&#8221;, cmd: &#8220;formatBlock&#8221;, val: &#8220;H1&#8221; }, { label: &#8220;H2&#8221;, cmd: &#8220;formatBlock&#8221;, val: &#8220;H2&#8221; }, { label: &#8220;\u2261&#8221;, cmd: &#8220;justifyLeft&#8221; }, { label: &#8220;\u2261\u0308&#8221;, cmd: &#8220;justifyCenter&#8221; }, { label: &#8220;\u2022 \u5217\u8868&#8221;, cmd: &#8220;insertUnorderedList&#8221; }, { label: &#8220;1. \u5217\u8868&#8221;, cmd: &#8220;insertOrderedList&#8221; }, { label: &#8220;\u21a9 \u64a4\u9500&#8221;, cmd: &#8220;undo&#8221; }, { label: &#8220;\u21aa \u91cd\u505a&#8221;, cmd: &#8220;redo&#8221; }, ]; return ( &lt;div style={{ border: &#8220;2px solid #e1e5e9&#8221;, borderRadius: 12, overflow: &#8220;hidden&#8221; }}> &lt;div style={{ display: &#8220;flex&#8221;, flexWrap: &#8220;wrap&#8221;, gap: 4, padding: &#8220;8px 10px&#8221;, background: &#8220;#f8f9fa&#8221;, borderBottom: &#8220;1px solid #e1e5e9&#8243; }}> {tools.map((t, i) => ( &lt;button key={i} type=&#8221;button&#8221; onMouseDown={(e) => { e.preventDefault(); exec(t.cmd, t.val); }} style={{ padding: &#8220;4px 10px&#8221;, border: &#8220;1px solid #ddd&#8221;, borderRadius: 6, background: &#8220;#fff&#8221;, cursor: &#8220;pointer&#8221;, fontSize: 13, &#8230;(t.s || {}) }}> {t.label} &lt;\/button> ))} &lt;\/div> &lt;div ref={ref} contentEditable suppressContentEditableWarning onInput={() => { skip.current = true; onChange(ref.current.innerHTML); }} style={{ minHeight: 200, padding: 16, fontSize: 15, lineHeight: 1.7, outline: &#8220;none&#8221;, background: &#8220;#fff&#8221; }} \/> &lt;\/div> ); } const fmtDate = (d) => new Date(d).toLocaleDateString(&#8220;zh-CN&#8221;); const S = { wrap: { minHeight: &#8220;100vh&#8221;, background: &#8220;linear-gradient(135deg,#667eea,#764ba2)&#8221;, padding: 20, fontFamily: &#8220;Microsoft YaHei,Arial,sans-serif&#8221; }, inner: { maxWidth: 1100, margin: &#8220;0 auto&#8221; }, card: { background: &#8220;rgba(255,255,255,0.97)&#8221;, borderRadius: 20, padding: 28, marginBottom: 24, boxShadow: &#8220;0 8px 32px rgba(0,0,0,.1)&#8221; }, btn: { padding: &#8220;10px 22px&#8221;, borderRadius: 50, border: &#8220;none&#8221;, cursor: &#8220;pointer&#8221;, fontWeight: 500, fontSize: 14, background: &#8220;linear-gradient(45deg,#667eea,#764ba2)&#8221;, color: &#8220;#fff&#8221; }, btnSec: { padding: &#8220;10px 22px&#8221;, borderRadius: 50, border: &#8220;none&#8221;, cursor: &#8220;pointer&#8221;, fontWeight: 500, fontSize: 14, background: &#8220;linear-gradient(45deg,#6c757d,#495057)&#8221;, color: &#8220;#fff&#8221; }, btnSm: { padding: &#8220;7px 14px&#8221;, borderRadius: 50, border: &#8220;none&#8221;, cursor: &#8220;pointer&#8221;, fontWeight: 500, fontSize: 13, background: &#8220;linear-gradient(45deg,#667eea,#764ba2)&#8221;, color: &#8220;#fff&#8221; }, btnSmSec: { padding: &#8220;7px 14px&#8221;, borderRadius: 50, border: &#8220;none&#8221;, cursor: &#8220;pointer&#8221;, fontWeight: 500, fontSize: 13, background: &#8220;linear-gradient(45deg,#6c757d,#495057)&#8221;, color: &#8220;#fff&#8221; }, btnDanger: { padding: &#8220;7px 14px&#8221;, borderRadius: 50, border: &#8220;none&#8221;, cursor: &#8220;pointer&#8221;, fontWeight: 500, fontSize: 13, background: &#8220;linear-gradient(45deg,#dc3545,#c82333)&#8221;, color: &#8220;#fff&#8221; }, input: { width: &#8220;100%&#8221;, padding: &#8220;12px 15px&#8221;, border: &#8220;2px solid #e1e5e9&#8221;, borderRadius: 12, fontSize: 15, boxSizing: &#8220;border-box&#8221;, background: &#8220;#f8f9fa&#8221; }, label: { display: &#8220;block&#8221;, fontWeight: 600, marginBottom: 8, color: &#8220;#333&#8221; }, }; export default function App() { const [page, setPage] = useState(&#8220;list&#8221;); const [articles, setArticles] = useState(initArticles); const [nid, setNid] = useState(3); const [search, setSearch] = useState(&#8220;&#8221;); const [catF, setCatF] = useState(&#8220;&#8221;); const [cur, setCur] = useState(null); const [msg, setMsg] = useState(null); const blank = { id: &#8220;&#8221;, title: &#8220;&#8221;, author: &#8220;&#8221;, category: &#8220;&#8221;, tags: &#8220;&#8221;, content: &#8220;&#8221; }; const [form, setForm] = useState(blank); const showMsg = (text, type = &#8220;success&#8221;) => { setMsg({ text, type }); setTimeout(() => setMsg(null), 3000); }; const goList = () => setPage(&#8220;list&#8221;); const goCreate = () => { setForm(blank); setPage(&#8220;create&#8221;); }; const goEdit = (a) => { setForm({ &#8230;a }); setPage(&#8220;edit&#8221;); }; const goView = (a) => { setCur(a); setPage(&#8220;view&#8221;); }; const filtered = articles.filter((a) => { const s = search.toLowerCase(); return (!s || a.title.toLowerCase().includes(s) || a.content.toLowerCase().includes(s)) &amp;&amp; (!catF || a.category === catF); }); const handleSave = () => { if (!form.title || !form.author || !form.category || !form.content) { showMsg(&#8220;\u8bf7\u586b\u5199\u6240\u6709\u5fc5\u9700\u5b57\u6bb5\uff01&#8221;, &#8220;error&#8221;); return; } if (form.id) { setArticles((p) => p.map((a) => (a.id === form.id ? { &#8230;a, &#8230;form } : a))); showMsg(&#8220;\u6587\u7ae0\u66f4\u65b0\u6210\u529f\uff01&#8221;); } else { setArticles((p) => [{ &#8230;form, id: nid, date: new Date().toISOString() }, &#8230;p]); setNid((n) => n + 1); showMsg(&#8220;\u6587\u7ae0\u53d1\u5e03\u6210\u529f\uff01&#8221;); } goList(); }; const delArticle = (id) => { if (!window.confirm(&#8220;\u786e\u5b9a\u8981\u5220\u9664\u8fd9\u7bc7\u6587\u7ae0\u5417\uff1f&#8221;)) return; setArticles((p) => p.filter((a) => a.id !== id)); showMsg(&#8220;\u6587\u7ae0\u5220\u9664\u6210\u529f\uff01&#8221;); if (page === &#8220;view&#8221;) goList(); }; const set = (k) => (e) => setForm((f) => ({ &#8230;f, [k]: e.target.value })); return ( &lt;div style={S.wrap}> &lt;div style={S.inner}> {\/* Header *\/} &lt;div style={{ &#8230;S.card, textAlign: &#8220;center&#8221; }}> &lt;h1 style={{ fontSize: &#8220;2em&#8221;, background: &#8220;linear-gradient(45deg,#667eea,#764ba2)&#8221;, WebkitBackgroundClip: &#8220;text&#8221;, WebkitTextFillColor: &#8220;transparent&#8221;, marginBottom: 6 }}> \ud83d\udcf0 PHP\u65b0\u95fb\u53d1\u5e03\u7cfb\u7edf &lt;\/h1> &lt;p style={{ color: &#8220;#666&#8221;, marginBottom: 16 }}>\u4e13\u4e1a\u7684\u5185\u5bb9\u7ba1\u7406\u5e73\u53f0\uff0c\u8ba9\u521b\u4f5c\u66f4\u7b80\u5355&lt;\/p> &lt;div style={{ display: &#8220;flex&#8221;, justifyContent: &#8220;center&#8221;, gap: 16 }}> &lt;button style={S.btn} onClick={goList}>\ud83d\udccb \u6587\u7ae0\u7ba1\u7406&lt;\/button> &lt;button style={S.btn} onClick={goCreate}>\u270f\ufe0f \u53d1\u5e03\u6587\u7ae0&lt;\/button> &lt;\/div> &lt;\/div> {\/* Message *\/} {msg &amp;&amp; ( &lt;div style={{ padding: &#8220;14px 20px&#8221;, borderRadius: 12, marginBottom: 20, fontWeight: 500, color: &#8220;#fff&#8221;, background: msg.type === &#8220;success&#8221; ? &#8220;linear-gradient(45deg,#28a745,#20c997)&#8221; : &#8220;linear-gradient(45deg,#dc3545,#fd7e14)&#8221; }}> {msg.text} &lt;\/div> )} {\/* LIST *\/} {page === &#8220;list&#8221; &amp;&amp; ( &lt;> &lt;div style={S.card}> &lt;div style={{ display: &#8220;flex&#8221;, justifyContent: &#8220;space-between&#8221;, alignItems: &#8220;center&#8221;, marginBottom: 20 }}> &lt;h2 style={{ color: &#8220;#333&#8221; }}>\u6587\u7ae0\u7ba1\u7406\u4e2d\u5fc3&lt;\/h2> &lt;button style={S.btn} onClick={goCreate}>+ \u53d1\u5e03\u65b0\u6587\u7ae0&lt;\/button> &lt;\/div> &lt;div style={{ display: &#8220;grid&#8221;, gridTemplateColumns: &#8220;1fr auto auto&#8221;, gap: 12 }}> &lt;input style={S.input} placeholder=&#8221;\ud83d\udd0d \u641c\u7d22\u6587\u7ae0&#8230;&#8221; value={search} onChange={(e) => setSearch(e.target.value)} \/> &lt;select style={{ &#8230;S.input, width: &#8220;auto&#8221; }} value={catF} onChange={(e) => setCatF(e.target.value)}> &lt;option value=&#8221;&#8221;>\ud83d\udcc2 \u5168\u90e8&lt;\/option> {CATEGORIES.map((c) => &lt;option key={c}>{c}&lt;\/option>)} &lt;\/select> &lt;button style={S.btn}>\u641c\u7d22&lt;\/button> &lt;\/div> &lt;\/div> {filtered.length === 0 ? ( &lt;div style={{ &#8230;S.card, textAlign: &#8220;center&#8221;, color: &#8220;#888&#8221;, padding: &#8220;60px 20px&#8221; }}>\ud83d\udcdd \u6682\u65e0\u6587\u7ae0\uff0c\u70b9\u51fb\u6309\u94ae\u5f00\u59cb\u521b\u4f5c\u5427\uff01&lt;\/div> ) : ( &lt;div style={{ display: &#8220;grid&#8221;, gridTemplateColumns: &#8220;repeat(auto-fill,minmax(320px,1fr))&#8221;, gap: 22 }}> {filtered.map((a) => ( &lt;div key={a.id} style={{ &#8230;S.card, marginBottom: 0 }}> &lt;div style={{ display: &#8220;flex&#8221;, justifyContent: &#8220;space-between&#8221;, alignItems: &#8220;center&#8221;, marginBottom: 10 }}> &lt;span style={{ background: &#8220;linear-gradient(45deg,#667eea,#764ba2)&#8221;, color: &#8220;#fff&#8221;, padding: &#8220;3px 14px&#8221;, borderRadius: 20, fontSize: 12 }}>{a.category}&lt;\/span> &lt;span style={{ color: &#8220;#888&#8221;, fontSize: 13 }}>\ud83d\udcc5 {fmtDate(a.date)}&lt;\/span> &lt;\/div> &lt;h3 style={{ fontSize: &#8220;1.1em&#8221;, marginBottom: 10, color: &#8220;#333&#8221; }}>{a.title}&lt;\/h3> &lt;div style={{ color: &#8220;#666&#8221;, fontSize: 14, marginBottom: 10, overflow: &#8220;hidden&#8221;, display: &#8220;-webkit-box&#8221;, WebkitLineClamp: 3, WebkitBoxOrient: &#8220;vertical&#8221; }} dangerouslySetInnerHTML={{ __html: a.content }} \/> &lt;div style={{ color: &#8220;#666&#8221;, fontSize: 13, marginBottom: 10 }}>\ud83d\udc64 {a.author}&lt;\/div> {a.tags &amp;&amp; ( &lt;div style={{ display: &#8220;flex&#8221;, flexWrap: &#8220;wrap&#8221;, gap: 6, marginBottom: 14 }}> {a.tags.split(&#8220;,&#8221;).slice(0, 3).map((t) => ( &lt;span key={t} style={{ background: &#8220;#f1f3f4&#8221;, color: &#8220;#5f6368&#8221;, padding: &#8220;3px 10px&#8221;, borderRadius: 12, fontSize: 12 }}>#{t.trim()}&lt;\/span> ))} &lt;\/div> )} &lt;div style={{ display: &#8220;flex&#8221;, gap: 8 }}> &lt;button style={S.btnSm} onClick={() => goView(a)}>\ud83d\udc41\ufe0f \u67e5\u770b&lt;\/button> &lt;button style={S.btnSmSec} onClick={() => goEdit(a)}>\u270f\ufe0f \u7f16\u8f91&lt;\/button> &lt;button style={S.btnDanger} onClick={() => delArticle(a.id)}>\ud83d\uddd1\ufe0f \u5220\u9664&lt;\/button> &lt;\/div> &lt;\/div> ))} &lt;\/div> )} &lt;\/> )} {\/* CREATE \/ EDIT *\/} {(page === &#8220;create&#8221; || page === &#8220;edit&#8221;) &amp;&amp; ( &lt;div style={S.card}> &lt;div style={{ display: &#8220;flex&#8221;, justifyContent: &#8220;space-between&#8221;, alignItems: &#8220;center&#8221;, marginBottom: 24 }}> &lt;h2 style={{ color: &#8220;#333&#8221; }}>{page === &#8220;edit&#8221; ? &#8220;\u270f\ufe0f \u7f16\u8f91\u6587\u7ae0&#8221; : &#8220;\ud83d\udcdd \u53d1\u5e03\u65b0\u6587\u7ae0&#8221;}&lt;\/h2> &lt;button style={S.btnSec} onClick={goList}>\u2190 \u8fd4\u56de\u5217\u8868&lt;\/button> &lt;\/div> &lt;div style={{ marginBottom: 20 }}> &lt;label style={S.label}>\ud83d\udcdd \u6587\u7ae0\u6807\u9898 *&lt;\/label> &lt;input style={S.input} placeholder=&#8221;\u8bf7\u8f93\u5165\u5438\u5f15\u4eba\u7684\u6807\u9898&#8230;&#8221; value={form.title} onChange={set(&#8220;title&#8221;)} \/> &lt;\/div> &lt;div style={{ display: &#8220;grid&#8221;, gridTemplateColumns: &#8220;1fr 1fr&#8221;, gap: 20, marginBottom: 20 }}> &lt;div> &lt;label style={S.label}>\ud83d\udc64 \u4f5c\u8005 *&lt;\/label> &lt;input style={S.input} placeholder=&#8221;\u8bf7\u8f93\u5165\u4f5c\u8005\u59d3\u540d&#8221; value={form.author} onChange={set(&#8220;author&#8221;)} \/> &lt;\/div> &lt;div> &lt;label style={S.label}>\ud83d\udcc2 \u5206\u7c7b *&lt;\/label> &lt;select style={S.input} value={form.category} onChange={set(&#8220;category&#8221;)}> &lt;option value=&#8221;&#8221;>\u8bf7\u9009\u62e9\u5206\u7c7b&lt;\/option> {CATEGORIES.map((c) => &lt;option key={c}>{c}&lt;\/option>)} &lt;\/select> &lt;\/div> &lt;\/div> &lt;div style={{ marginBottom: 20 }}> &lt;label style={S.label}>\ud83c\udff7\ufe0f \u6807\u7b7e\uff08\u7528\u9017\u53f7\u5206\u9694\uff09&lt;\/label> &lt;input style={S.input} placeholder=&#8221;\u4f8b\u5982\uff1a\u79d1\u6280,\u521b\u65b0,\u4eba\u5de5\u667a\u80fd&#8221; value={form.tags} onChange={set(&#8220;tags&#8221;)} \/> &lt;\/div> &lt;div style={{ marginBottom: 24 }}> &lt;label style={S.label}>\ud83d\udcc4 \u6587\u7ae0\u5185\u5bb9\uff08\u5bcc\u6587\u672c\u7f16\u8f91\u5668\uff09*&lt;\/label> &lt;RichEditor value={form.content} onChange={(v) => setForm((f) => ({ &#8230;f, content: v }))} \/> &lt;\/div> &lt;div style={{ textAlign: &#8220;center&#8221; }}> &lt;button style={{ &#8230;S.btn, marginRight: 12 }} onClick={handleSave}> \ud83d\udcbe {page === &#8220;edit&#8221; ? &#8220;\u66f4\u65b0\u6587\u7ae0&#8221; : &#8220;\u53d1\u5e03\u6587\u7ae0&#8221;} &lt;\/button> &lt;button style={S.btnSec} onClick={goList}>\u53d6\u6d88&lt;\/button> &lt;\/div> &lt;\/div> )} {\/* VIEW *\/} {page === &#8220;view&#8221; &amp;&amp; cur &amp;&amp; ( &lt;div style={{ &#8230;S.card, maxWidth: 800, margin: &#8220;0 auto&#8221; }}> &lt;div style={{ display: &#8220;flex&#8221;, justifyContent: &#8220;space-between&#8221;, alignItems: &#8220;center&#8221;, marginBottom: 24 }}> &lt;button style={S.btnSec} onClick={goList}>\u2190 \u8fd4\u56de\u5217\u8868&lt;\/button> &lt;div style={{ display: &#8220;flex&#8221;, gap: 8 }}> &lt;button style={S.btnSmSec} onClick={() => goEdit(cur)}>\u270f\ufe0f \u7f16\u8f91&lt;\/button> &lt;button style={S.btnDanger} onClick={() => delArticle(cur.id)}>\ud83d\uddd1\ufe0f \u5220\u9664&lt;\/button> &lt;\/div> &lt;\/div> &lt;h1 style={{ color: &#8220;#333&#8221;, marginBottom: 20, fontSize: &#8220;1.8em&#8221;, lineHeight: 1.3 }}>{cur.title}&lt;\/h1> &lt;div style={{ background: &#8220;#f8f9fa&#8221;, padding: 18, borderRadius: 14, marginBottom: 24, display: &#8220;grid&#8221;, gridTemplateColumns: &#8220;repeat(auto-fit,minmax(160px,1fr))&#8221;, gap: 12, fontSize: 14 }}> &lt;div>&lt;strong>\ud83d\udc64 \u4f5c\u8005\uff1a&lt;\/strong>{cur.author}&lt;\/div> &lt;div>&lt;strong>\ud83d\udcc2 \u5206\u7c7b\uff1a&lt;\/strong>{cur.category}&lt;\/div> &lt;div>&lt;strong>\ud83d\udcc5 \u65f6\u95f4\uff1a&lt;\/strong>{fmtDate(cur.date)}&lt;\/div> {cur.tags &amp;&amp; &lt;div>&lt;strong>\ud83c\udff7\ufe0f \u6807\u7b7e\uff1a&lt;\/strong>{cur.tags}&lt;\/div>} &lt;\/div> &lt;div style={{ lineHeight: 1.8, color: &#8220;#444&#8221;, fontSize: &#8220;1.05em&#8221; }} dangerouslySetInnerHTML={{ __html: cur.content }} \/> &lt;\/div> )} &lt;\/div> &lt;\/div> ); }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u91cd\u5199\u4e3a React \u7ec4\u4ef6 \u2014 \u539f\u6765\u7684 a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[12,13],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-javescript","category-vue-react-next-js-node-js"],"_links":{"self":[{"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":1,"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":42,"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions\/42"}],"wp:attachment":[{"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/word.ronrin.cn\/index.php\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}