{"id":27957,"date":"2024-11-24T17:52:59","date_gmt":"2024-11-24T09:52:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27957\/"},"modified":"2024-11-24T17:52:59","modified_gmt":"2024-11-24T09:52:59","slug":"%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e7%bd%91%e9%a1%b5%e6%96%87%e6%9c%ac%e8%87%aa%e5%8a%a8%e7%9c%81%e7%95%a5%e5%89%8d%e4%b8%a4%e8%a1%8c%ef%bc%8c%e5%b9%b6%e5%9c%a8%e5%90%8e%e9%9d%a2%e8%bf%bd%e5%8a%a0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27957\/","title":{"rendered":"\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u672c\u81ea\u52a8\u7701\u7565\u524d\u4e24\u884c\uff0c\u5e76\u5728\u540e\u9762\u8ffd\u52a0\u52a8\u6001\u5185\u5bb9\u5757\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173137087225501.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u672c\u81ea\u52a8\u7701\u7565\u524d\u4e24\u884c\uff0c\u5e76\u5728\u540e\u9762\u8ffd\u52a0\u52a8\u6001\u5185\u5bb9\u5757\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u672c\u81ea\u52a8\u7701\u7565\u524d\u4e24\u884c\uff0c\u5e76\u5728\u540e\u9762\u8ffd\u52a0\u52a8\u6001\u5185\u5bb9\u5757\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728\u7f51\u9875\u4e0a\u5de7\u5999\u5730\u7701\u7565\u4e24\u884c\u6587\u5b57\uff0c\u5e76\u7f6e\u4e8e\u52a8\u6001\u5185\u5bb9\u5757\u4e4b\u540e\uff1f<\/strong><\/p>\n<p>\u5728\u7f51\u9875\u8bbe\u8ba1\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u5728\u6709\u9650\u7684\u7a7a\u95f4\u5185\u5448\u73b0\u52a8\u6001\u5185\u5bb9\uff0c\u540c\u65f6\u907f\u514d\u5197\u4f59\u4fe1\u606f\u3002\u95ee\u9898\u662f\u600e\u4e48\u5b9e\u73b0\u5f53\u6587\u5b57\u5185\u5bb9\u8f83\u957f\u65f6\uff0c\u80fd\u591f\u81ea\u52a8\u7701\u7565\u524d\u4e24\u884c\uff0c\u5e76\u5728\u540e\u9762\u8ffd\u52a0\u4e00\u4e2a\u52a8\u6001\u5185\u5bb9\u5757\u3002<\/p>\n<p>\u5982\u4eca\uff0c\u79fb\u52a8\u8bbe\u5907\u7684\u666e\u53ca\uff0c\u4f7f\u5f97\u5c3a\u5bf8\u53d7\u9650\u7684\u9875\u9762\u8bbe\u8ba1\u6108\u53d1\u5e38\u89c1\u3002\u5982\u4f55\u7f8e\u89c2\u5730\u5c55\u793a\u5185\u5bb9\u7684\u540c\u65f6\uff0c\u4fdd\u6301\u826f\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff0c\u53ef\u8c13\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<p>\u6709\u591a\u79cd\u65b9\u6cd5\u53ef\u4ee5\u8fbe\u6210\u8fd9\u4e2a\u6548\u679c\uff0c\u5305\u62ec\u4f7f\u7528\uff1a<\/p>\n<p><strong><\/strong><\/p>\n<p>text-: ellipsis; \u5c5e\u6027\u53ef\u4ee5\u7701\u7565\u8d85\u51fa\u5bb9\u5668\u5bbd\u5ea6\u7684\u5185\u5bb9\uff0c\u5e76\u5c06\u5176\u66ff\u6362\u4e3a\u7701\u7565\u53f7\uff08&#8230;\uff09\u3002\u4f46\u662f\uff0c\u6b64\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u5355\u884c\u6587\u672c\u3002<\/p>\n<p><strong>js<\/strong><\/p>\n<p>\u4f7f\u7528 javascript \u53ef\u4ee5\u52a8\u6001\u5730\u8ba1\u7b97\u6587\u672c\u957f\u5ea6\uff0c\u5e76\u5728\u6587\u672c\u8d85\u8fc7\u4e00\u5b9a\u957f\u5ea6\u65f6\u622a\u65ad\u5b83\u3002<\/p>\n<p><strong>ant design mobile \u7ec4\u4ef6<\/strong><\/p>\n<p>ant design mobile \u6846\u67b6\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4e13\u95e8\u7528\u4e8e\u5b9e\u73b0\u6b64\u6548\u679c\u7684\u7ec4\u4ef6\uff1aellipsis\u3002<\/p>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528 css \u5b9e\u73b0\u6587\u672c\u7701\u7565\u5e76\u8ffd\u52a0\u52a8\u6001\u5185\u5bb9\u5757\uff1a<\/p>\n<pre>.container {\n  width: 200px;\n}\n\np {\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  overflow: hidden;\n}\n\n.dynamic-content {\n  float: right;\n  width: 30px;\n  height: 30px;\n  background-color: red;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>&lt;div class=\"container\"&gt;\n  &lt;p&gt;\u957f\u6587\u672c\u957f\u6587\u672c\u957f\u6587\u672c\u957f\u6587\u672c\u957f\u6587\u672c&lt;\/p&gt;\n  &lt;div class=\"dynamic-content\"&gt;&lt;\/div&gt;\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u793a\u4f8b\u4e2d\uff0c&#8221;\u957f\u6587\u672c&#8230;&#8221; \u5c06\u88ab\u7701\u7565\uff0c\u5e76\u663e\u793a\u5728\u52a8\u6001\u5185\u5bb9\u5757\u4e4b\u540e\u3002<\/p>\n<p>\u66f4\u591a\u53c2\u8003\uff1a<\/p>\n<ul>\n<li>[css text overflow](https:\/\/developer.mozilla.org\/en-us\/docs\/web\/css\/text-overflow)<\/li>\n<li>[javascript string truncation](https:\/\/developer.mozilla.org\/en-us\/docs\/web\/javascript\/reference\/global_objects\/string\/substr)<\/li>\n<li>[ant design mobile ellipsis](https:\/\/mobile.ant.design\/components\/ellipsis)<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b9e\u73b0\u7f51\u9875\u6587\u672c\u81ea\u52a8\u7701\u7565\u524d\u4e24\u884c\uff0c\u5e76\u5728\u540e\u9762\u8ffd\u52a0\u52a8\u6001\u5185\u5bb9\u5757\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>\u5982\u4f55\u5728\u7f51\u9875\u4e0a\u5de7\u5999\u5730\u7701\u7565\u4e24\u884c\u6587\u5b57\uff0c\u5e76\u7f6e\u4e8e\u52a8\u6001\u5185\u5bb9\u5757\u4e4b\u540e\uff1f \u5728\u7f51\u9875\u8bbe\u8ba1\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u5728\u6709\u9650\u7684\u7a7a\u95f4\u5185\u5448\u73b0\u52a8\u6001\u5185\u5bb9\uff0c\u540c\u65f6\u907f\u514d\u5197\u4f59\u4fe1\u606f\u3002\u95ee\u9898\u662f\u600e\u4e48\u5b9e\u73b0\u5f53\u6587\u5b57\u5185\u5bb9\u8f83\u957f\u65f6\uff0c\u80fd\u591f\u81ea\u52a8\u7701\u7565\u524d\u4e24\u884c\uff0c\u5e76\u5728\u540e\u9762\u8ffd\u52a0\u4e00\u4e2a\u52a8\u6001\u5185\u5bb9\u5757\u3002 \u5982\u4eca\uff0c\u79fb\u52a8\u8bbe\u5907\u7684\u666e\u53ca\uff0c\u4f7f\u5f97\u5c3a\u5bf8\u53d7\u9650\u7684\u9875\u9762\u8bbe\u8ba1\u6108\u53d1\u5e38\u89c1\u3002\u5982\u4f55\u7f8e\u89c2\u5730\u5c55\u793a\u5185\u5bb9\u7684\u540c\u65f6\uff0c\u4fdd\u6301\u826f\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff0c\u53ef\u8c13\u81f3\u5173\u91cd\u8981\u3002 \u6709\u591a\u79cd\u65b9\u6cd5\u53ef\u4ee5\u8fbe\u6210\u8fd9\u4e2a\u6548\u679c\uff0c\u5305\u62ec\u4f7f\u7528\uff1a text-: ellipsis; \u5c5e\u6027\u53ef\u4ee5\u7701\u7565\u8d85\u51fa\u5bb9\u5668\u5bbd\u5ea6\u7684\u5185\u5bb9\uff0c\u5e76\u5c06\u5176\u66ff\u6362\u4e3a\u7701\u7565\u53f7\uff08&#8230;\uff09\u3002\u4f46\u662f\uff0c\u6b64\u65b9\u6cd5\u4ec5\u9002\u7528\u4e8e\u5355\u884c\u6587\u672c\u3002 js \u4f7f\u7528 javascript \u53ef\u4ee5\u52a8\u6001\u5730\u8ba1\u7b97\u6587\u672c\u957f\u5ea6\uff0c\u5e76\u5728\u6587\u672c\u8d85\u8fc7\u4e00\u5b9a\u957f\u5ea6\u65f6\u622a\u65ad\u5b83\u3002 ant design mobile \u7ec4\u4ef6 ant design mobile \u6846\u67b6\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4e13\u95e8\u7528\u4e8e\u5b9e\u73b0\u6b64\u6548\u679c\u7684\u7ec4\u4ef6\uff1aellipsis\u3002 \u793a\u4f8b \u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528 css \u5b9e\u73b0\u6587\u672c\u7701\u7565\u5e76\u8ffd\u52a0\u52a8\u6001\u5185\u5bb9\u5757\uff1a .container { width: 200px; } p { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } .dynamic-content { float: right; width: 30px; height: 30px; background-color: red; } \u767b\u5f55\u540e\u590d\u5236 &lt;div class=&#8221;container&#8221;&gt; &lt;p&gt;\u957f\u6587\u672c\u957f\u6587\u672c\u957f\u6587\u672c\u957f\u6587\u672c\u957f\u6587\u672c&lt;\/p&gt; &lt;div class=&#8221;dynamic-content&#8221;&gt;&lt;\/div&gt; &lt;\/div&gt; [&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-27957","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27957","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=27957"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27957\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}