/*! For license information please see 7691.3dbb8ad4.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["7691"],{4115:function(s,n,a){"use strict";a.r(n);var t=a("80681");let l=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
\u5BF9\u957F\u6587\u672C\u8FDB\u884C\u7701\u7565\uFF0C\u652F\u6301\u5C55\u5F00/\u6536\u8D77\u3002\u8BF7\u5347\u7EA7 vant
\u5230 >= 4.1.0 \u7248\u672C\u6765\u4F7F\u7528\u8BE5\u7EC4\u4EF6\u3002
\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5168\u5C40\u6CE8\u518C\u7EC4\u4EF6\uFF0C\u66F4\u591A\u6CE8\u518C\u65B9\u5F0F\u8BF7\u53C2\u8003\u7EC4\u4EF6\u6CE8\u518C\u3002
\nimport { createApp } from 'vue';\nimport { TextEllipsis } from 'vant';\n\nconst app = createApp();\napp.use(TextEllipsis);\n
\n\u9ED8\u8BA4\u5C55\u793A 1
\u884C\uFF0C\u8D85\u8FC7 1
\u884C\u663E\u793A\u7701\u7565\u53F7\u3002
<van-text-ellipsis :content="text" />\n
\nexport default {\n setup() {\n const text = '\u6162\u6162\u6765\uFF0C\u4E0D\u8981\u6025\uFF0C\u751F\u6D3B\u7ED9\u4F60\u51FA\u4E86\u96BE\u9898\uFF0C\u53EF\u4E5F\u7EC8\u6709\u4E00\u5929\u4F1A\u7ED9\u51FA\u7B54\u6848\u3002';\n return { text };\n },\n};\n
\n\u8D85\u8FC7\u884C\u6570\u652F\u6301\u5C55\u5F00/\u6536\u8D77\u3002
\n<van-text-ellipsis :content="text" expand-text="\u5C55\u5F00" collapse-text="\u6536\u8D77" />\n
\nexport default {\n setup() {\n const text =\n '\u4F3C\u6C34\u6D41\u5E74\u662F\u4E00\u4E2A\u4EBA\u6240\u6709\u7684\u4E00\u5207\uFF0C\u53EA\u6709\u8FD9\u4E2A\u4E1C\u897F\uFF0C\u624D\u771F\u6B63\u5F52\u4F60\u6240\u6709\u3002\u5176\u4F59\u7684\u4E00\u5207\uFF0C\u90FD\u662F\u7247\u523B\u7684\u6B22\u5A31\u548C\u4E0D\u5E78\uFF0C\u8F6C\u773C\u95F4\u5C31\u5DF2\u8DD1\u5230\u90A3\u4F3C\u6C34\u6D41\u5E74\u91CC\u53BB\u4E86\u3002';\n return { text };\n },\n};\n
\n\u901A\u8FC7\u8BBE\u7F6E rows
\u9650\u5236\u5C55\u793A\u884C\u6570\u3002
<van-text-ellipsis\n rows="3"\n :content="text"\n expand-text="\u5C55\u5F00"\n collapse-text="\u6536\u8D77"\n/>\n
\nexport default {\n setup() {\n const text =\n '\u90A3\u4E00\u5929\u6211\u4E8C\u5341\u4E00\u5C81\uFF0C\u5728\u6211\u4E00\u751F\u7684\u9EC4\u91D1\u65F6\u4EE3\u3002\u6211\u6709\u597D\u591A\u5962\u671B\u3002\u6211\u60F3\u7231\uFF0C\u60F3\u5403\uFF0C\u8FD8\u60F3\u5728\u4E00\u77AC\u95F4\u53D8\u6210\u5929\u4E0A\u534A\u660E\u534A\u6697\u7684\u4E91\u3002\u540E\u6765\u6211\u624D\u77E5\u9053\uFF0C\u751F\u6D3B\u5C31\u662F\u4E2A\u7F13\u6162\u53D7\u9524\u7684\u8FC7\u7A0B\uFF0C\u4EBA\u4E00\u5929\u5929\u8001\u4E0B\u53BB\uFF0C\u5962\u671B\u4E5F\u4E00\u5929\u5929\u6D88\u5931\uFF0C\u6700\u540E\u53D8\u5F97\u50CF\u6328\u4E86\u9524\u7684\u725B\u4E00\u6837\u3002\u53EF\u662F\u6211\u8FC7\u4E8C\u5341\u4E00\u5C81\u751F\u65E5\u65F6\u6CA1\u6709\u9884\u89C1\u5230\u8FD9\u4E00\u70B9\u3002\u6211\u89C9\u5F97\u81EA\u5DF1\u4F1A\u6C38\u8FDC\u751F\u731B\u4E0B\u53BB\uFF0C\u4EC0\u4E48\u4E5F\u9524\u4E0D\u4E86\u6211\u3002';\n return { text };\n },\n};\n
\n\u901A\u8FC7\u8BBE\u7F6E position
\u63A7\u5236\u7701\u7565\u4F4D\u7F6E\u3002
<van-text-ellipsis\n rows="1"\n :content="text"\n expand-text="\u5C55\u5F00"\n collapse-text="\u6536\u8D77"\n position="start"\n/>\n
\nexport default {\n setup() {\n const text =\n '\u90A3\u4E00\u5929\u6211\u4E8C\u5341\u4E00\u5C81\uFF0C\u5728\u6211\u4E00\u751F\u7684\u9EC4\u91D1\u65F6\u4EE3\u3002\u6211\u6709\u597D\u591A\u5962\u671B\u3002\u6211\u60F3\u7231\uFF0C\u60F3\u5403\uFF0C\u8FD8\u60F3\u5728\u4E00\u77AC\u95F4\u53D8\u6210\u5929\u4E0A\u534A\u660E\u534A\u6697\u7684\u4E91\u3002\u540E\u6765\u6211\u624D\u77E5\u9053\uFF0C\u751F\u6D3B\u5C31\u662F\u4E2A\u7F13\u6162\u53D7\u9524\u7684\u8FC7\u7A0B\uFF0C\u4EBA\u4E00\u5929\u5929\u8001\u4E0B\u53BB\uFF0C\u5962\u671B\u4E5F\u4E00\u5929\u5929\u6D88\u5931\uFF0C\u6700\u540E\u53D8\u5F97\u50CF\u6328\u4E86\u9524\u7684\u725B\u4E00\u6837\u3002\u53EF\u662F\u6211\u8FC7\u4E8C\u5341\u4E00\u5C81\u751F\u65E5\u65F6\u6CA1\u6709\u9884\u89C1\u5230\u8FD9\u4E00\u70B9\u3002\u6211\u89C9\u5F97\u81EA\u5DF1\u4F1A\u6C38\u8FDC\u751F\u731B\u4E0B\u53BB\uFF0C\u4EC0\u4E48\u4E5F\u9524\u4E0D\u4E86\u6211\u3002';\n return { text };\n },\n};\n
\n<van-text-ellipsis\n rows="2"\n :content="text"\n expand-text="\u5C55\u5F00"\n collapse-text="\u6536\u8D77"\n position="middle"\n/>\n
\nexport default {\n setup() {\n const text =\n '\u90A3\u4E00\u5929\u6211\u4E8C\u5341\u4E00\u5C81\uFF0C\u5728\u6211\u4E00\u751F\u7684\u9EC4\u91D1\u65F6\u4EE3\u3002\u6211\u6709\u597D\u591A\u5962\u671B\u3002\u6211\u60F3\u7231\uFF0C\u60F3\u5403\uFF0C\u8FD8\u60F3\u5728\u4E00\u77AC\u95F4\u53D8\u6210\u5929\u4E0A\u534A\u660E\u534A\u6697\u7684\u4E91\u3002\u540E\u6765\u6211\u624D\u77E5\u9053\uFF0C\u751F\u6D3B\u5C31\u662F\u4E2A\u7F13\u6162\u53D7\u9524\u7684\u8FC7\u7A0B\uFF0C\u4EBA\u4E00\u5929\u5929\u8001\u4E0B\u53BB\uFF0C\u5962\u671B\u4E5F\u4E00\u5929\u5929\u6D88\u5931\uFF0C\u6700\u540E\u53D8\u5F97\u50CF\u6328\u4E86\u9524\u7684\u725B\u4E00\u6837\u3002\u53EF\u662F\u6211\u8FC7\u4E8C\u5341\u4E00\u5C81\u751F\u65E5\u65F6\u6CA1\u6709\u9884\u89C1\u5230\u8FD9\u4E00\u70B9\u3002\u6211\u89C9\u5F97\u81EA\u5DF1\u4F1A\u6C38\u8FDC\u751F\u731B\u4E0B\u53BB\uFF0C\u4EC0\u4E48\u4E5F\u9524\u4E0D\u4E86\u6211\u3002';\n return { text };\n },\n};\n
\n\u901A\u8FC7\u63D2\u69FD action
\u81EA\u5B9A\u4E49\u64CD\u4F5C\u5185\u5BB9\u3002
<van-text-ellipsis :content="text">\n <template #action="{ expanded }">{{ expanded ? '\u6536\u8D77' : '\u5C55\u5F00' }}</template>\n</van-text-ellipsis>\n
\nexport default {\n setup() {\n const text = '\u6162\u6162\u6765\uFF0C\u4E0D\u8981\u6025\uFF0C\u751F\u6D3B\u7ED9\u4F60\u51FA\u4E86\u96BE\u9898\uFF0C\u53EF\u4E5F\u7EC8\u6709\u4E00\u5929\u4F1A\u7ED9\u51FA\u7B54\u6848\u3002';\n return { text };\n },\n};\n
\n\u53C2\u6570 | \n\u8BF4\u660E | \n\u7C7B\u578B | \n\u9ED8\u8BA4\u503C | \n
---|---|---|---|
rows | \n\u5C55\u793A\u7684\u884C\u6570 | \nnumber | string | \n1 | \n
content | \n\u9700\u8981\u5C55\u793A\u7684\u6587\u672C | \nstring | \n- | \n
expand-text | \n\u5C55\u5F00\u64CD\u4F5C\u7684\u6587\u6848 | \nstring | \n- | \n
collapse-text | \n\u6536\u8D77\u64CD\u4F5C\u7684\u6587\u6848 | \nstring | \n- | \n
dots v4.2.0 | \n\u7701\u7565\u53F7\u7684\u6587\u672C\u5185\u5BB9 | \nstring | \n\'...\' | \n
position v4.6.2 | \n\u7701\u7565\u4F4D\u7F6E\uFF0C\u53EF\u9009\u503C\u4E3A start middle | \nstring | \n\'end\' | \n
\u4E8B\u4EF6\u540D | \n\u8BF4\u660E | \n\u56DE\u8C03\u53C2\u6570 | \n
---|---|---|
click-action | \n\u70B9\u51FB\u5C55\u5F00/\u6536\u8D77\u65F6\u89E6\u53D1 | \nevent: MouseEvent | \n
\u901A\u8FC7 ref \u53EF\u4EE5\u83B7\u53D6\u5230 TextEllipsis \u5B9E\u4F8B\u5E76\u8C03\u7528\u5B9E\u4F8B\u65B9\u6CD5\uFF0C\u8BE6\u89C1\u7EC4\u4EF6\u5B9E\u4F8B\u65B9\u6CD5\u3002
\n\u65B9\u6CD5\u540D | \n\u8BF4\u660E | \n\u53C2\u6570 | \n\u8FD4\u56DE\u503C | \n
---|---|---|---|
toggle | \n\u5207\u6362\u6587\u672C\u7684\u5C55\u5F00\u72B6\u6001\uFF0C\u4F20 true \u4E3A\u5C55\u5F00\uFF0Cfalse \u4E3A\u6536\u8D77\uFF0C\u4E0D\u4F20\u53C2\u4E3A\u5207\u6362 | \nexpanded?: boolean | \n- | \n
\u540D\u79F0 | \n\u8BF4\u660E | \n\u53C2\u6570 | \n
---|---|---|
action v4.8.3 | \n\u81EA\u5B9A\u4E49\u64CD\u4F5C | \n{ expanded: boolean } | \n
\u7EC4\u4EF6\u5BFC\u51FA\u4EE5\u4E0B\u7C7B\u578B\u5B9A\u4E49\uFF1A
\nimport type {\n TextEllipsisProps,\n TextEllipsisInstance,\n TextEllipsisThemeVars,\n} from 'vant';\n
\nTextEllipsisInstance
\u662F\u7EC4\u4EF6\u5B9E\u4F8B\u7684\u7C7B\u578B\uFF0C\u7528\u6CD5\u5982\u4E0B\uFF1A
import { ref } from 'vue';\nimport type { TextEllipsisInstance } from 'vant';\n\nconst textEllipsisRef = ref<TextEllipsisInstance>();\n\ntextEllipsisRef.value?.toggle();\n
\n\u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E0B\u5217 CSS \u53D8\u91CF\uFF0C\u53EF\u7528\u4E8E\u81EA\u5B9A\u4E49\u6837\u5F0F\uFF0C\u4F7F\u7528\u65B9\u6CD5\u8BF7\u53C2\u8003 ConfigProvider \u7EC4\u4EF6\u3002
\n\u540D\u79F0 | \n\u9ED8\u8BA4\u503C | \n\u63CF\u8FF0 | \n
---|---|---|
--van-text-ellipsis-action-color | \nvar(--van-blue) | \n\u64CD\u4F5C\u6309\u94AE\u7684\u989C\u8272 | \n
--van-text-ellipsis-line-height | \n1.6 | \n\u6587\u672C\u7684\u884C\u9AD8 | \n