{"id":28283,"date":"2024-11-24T12:23:05","date_gmt":"2024-11-24T04:23:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28283\/"},"modified":"2024-11-24T12:23:05","modified_gmt":"2024-11-24T04:23:05","slug":"%e5%ad%90%e7%bb%84%e4%bb%b6%e5%86%85%e5%ae%b9%e8%b6%85%e5%87%ba%e5%ae%b9%e5%99%a8%e6%97%b6%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e6%bb%9a%e5%8a%a8%e5%b1%95%e7%a4%ba%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28283\/","title":{"rendered":"\u5b50\u7ec4\u4ef6\u5185\u5bb9\u8d85\u51fa\u5bb9\u5668\u65f6\u5982\u4f55\u5b9e\u73b0\u6eda\u52a8\u5c55\u793a\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173148120473876.jpg\" class=\"aligncenter\" title=\"\u5b50\u7ec4\u4ef6\u5185\u5bb9\u8d85\u51fa\u5bb9\u5668\u65f6\u5982\u4f55\u5b9e\u73b0\u6eda\u52a8\u5c55\u793a\uff1f\u63d2\u56fe\" alt=\"\u5b50\u7ec4\u4ef6\u5185\u5bb9\u8d85\u51fa\u5bb9\u5668\u65f6\u5982\u4f55\u5b9e\u73b0\u6eda\u52a8\u5c55\u793a\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u8d85\u51fa\u754c\u9762\u65f6\u6eda\u52a8\u5c55\u793a\u7ec4\u4ef6<\/strong><\/p>\n<p>\u6709\u4e00\u4e2a\u5d4c\u5957\u5728 div \u4e2d\u7684\u5b50\u7ec4\u4ef6\uff0c\u4f46\u5f53\u7ec4\u4ef6\u6570\u636e\u8fc7\u591a\u65f6\uff0c\u5185\u5bb9\u4f1a\u6ea2\u51fa\u754c\u9762\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u9700\u8981\u5b9e\u73b0\u8d85\u51fa\u754c\u9762\u65f6\u8fdb\u884c\u6eda\u52a8\u5c55\u793a\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u8981\u5b9e\u73b0\u6eda\u52a8\u5c55\u793a\uff0c\u53ef\u4ee5\u5728 div \u6837\u5f0f\u4e2d\u6dfb\u52a0 : &#8216;auto&#8217; \u5c5e\u6027\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre>return (\n    &lt;div style={{borderRadius: '8px', border: '2px dashed #333', height: props.height, overflow: 'auto'}}&gt;\n        &lt;div style={{textAlign: 'left'}}&gt;\n            &lt;label&gt;{props.title}&lt;\/label&gt;\n        &lt;\/div&gt;\n        &lt;div&gt;\n            {props.data.map((item, index) =&gt; (\n                &lt;div\n                    key={`${index}-${item.type}-${item.value} `}\n                    style={{\n                        float: 'left',\n                        display: 'inline-block',\n                        borderRadius: '6px',\n                        border: '2px solid #000',\n                        margin: '8px',\n                        padding: '4px',\n                        backgroundColor: item.selected ? '#39fe40' : ''\n                    }}\n                &gt;\n                    {item.value}\n                &lt;\/div&gt;\n            ))}\n        &lt;\/div&gt;\n    &lt;\/div&gt;\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u6dfb\u52a0 overflow: &#8216;auto&#8217;\uff0c\u5f53\u5185\u5bb9\u8d85\u51fa div \u5927\u5c0f\u65f6\uff0c\u4f1a\u81ea\u52a8\u51fa\u73b0\u6eda\u52a8\u6761\uff0c\u5141\u8bb8\u7528\u6237\u4e0a\u4e0b\u62d6\u52a8\u6eda\u52a8\u67e5\u770b\u66f4\u591a\u5185\u5bb9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5b50\u7ec4\u4ef6\u5185\u5bb9\u8d85\u51fa\u5bb9\u5668\u65f6\u5982\u4f55\u5b9e\u73b0\u6eda\u52a8\u5c55\u793a\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8d85\u51fa\u754c\u9762\u65f6\u6eda\u52a8\u5c55\u793a\u7ec4\u4ef6 \u6709\u4e00\u4e2a\u5d4c\u5957\u5728 div \u4e2d\u7684\u5b50\u7ec4\u4ef6\uff0c\u4f46\u5f53\u7ec4\u4ef6\u6570\u636e\u8fc7\u591a\u65f6\uff0c\u5185\u5bb9\u4f1a\u6ea2\u51fa\u754c\u9762\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u9700\u8981\u5b9e\u73b0\u8d85\u51fa\u754c\u9762\u65f6\u8fdb\u884c\u6eda\u52a8\u5c55\u793a\u3002 \u89e3\u51b3\u65b9\u6848 \u8981\u5b9e\u73b0\u6eda\u52a8\u5c55\u793a\uff0c\u53ef\u4ee5\u5728 div \u6837\u5f0f\u4e2d\u6dfb\u52a0 : &#8216;auto&#8217; \u5c5e\u6027\uff0c\u5982\u4e0b\uff1a return ( &lt;div style={{borderRadius: &#8216;8px&#8217;, border: &#8216;2px dashed #333&#8217;, height: props.height, overflow: &#8216;auto&#8217;}}&gt; &lt;div style={{textAlign: &#8216;left&#8217;}}&gt; &lt;label&gt;{props.title}&lt;\/label&gt; &lt;\/div&gt; &lt;div&gt; {props.data.map((item, index) =&gt; ( &lt;div key={`${index}-${item.type}-${item.value} `} style={{ float: &#8216;left&#8217;, display: &#8216;inline-block&#8217;, borderRadius: &#8216;6px&#8217;, border: &#8216;2px solid #000&#8217;, margin: &#8216;8px&#8217;, padding: &#8216;4px&#8217;, backgroundColor: item.selected ? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-28283","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=28283"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28283\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}