diff --git a/src/share-sheet/README.md b/src/share-sheet/README.md index f835b5ba8..7493e8ac9 100644 --- a/src/share-sheet/README.md +++ b/src/share-sheet/README.md @@ -197,10 +197,11 @@ export default { ### Slots -| Name | Description | -| ----------- | ------------------ | -| title | Custom title | -| description | Custom description | +| Name | Description | +| ---------------- | ----------------------------------- | +| title | Custom title | +| description | Custom description | +| cancel `v3.0.10` | Custom the content of cancel button | ### Less Variables diff --git a/src/share-sheet/README.zh-CN.md b/src/share-sheet/README.zh-CN.md index cbf29ccb8..e5ac96a17 100644 --- a/src/share-sheet/README.zh-CN.md +++ b/src/share-sheet/README.zh-CN.md @@ -215,10 +215,11 @@ export default { ### Slots -| 名称 | 说明 | -| ----------- | -------------- | -| title | 自定义顶部标题 | -| description | 自定义描述文字 | +| 名称 | 说明 | +| ---------------- | ------------------ | +| title | 自定义顶部标题 | +| description | 自定义描述文字 | +| cancel `v3.0.10` | 自定义取消按钮内容 | ### 样式变量 diff --git a/src/share-sheet/ShareSheet.tsx b/src/share-sheet/ShareSheet.tsx index 110d4a601..c4f578e9b 100644 --- a/src/share-sheet/ShareSheet.tsx +++ b/src/share-sheet/ShareSheet.tsx @@ -127,12 +127,12 @@ export default defineComponent({ return renderOptions(options as ShareSheetOption[]); }; - const renderCancelText = () => { - const text = props.cancelText ?? t('cancel'); - if (text) { + const renderCancelButton = () => { + const cancelText = props.cancelText ?? t('cancel'); + if (slots.cancel || cancelText) { return ( ); } @@ -150,7 +150,7 @@ export default defineComponent({ > {renderHeader()} {renderRows()} - {renderCancelText()} + {renderCancelButton()} ); }, diff --git a/src/share-sheet/test/__snapshots__/index.spec.ts.snap b/src/share-sheet/test/__snapshots__/index.spec.ts.snap index 405b3a012..6321350f5 100644 --- a/src/share-sheet/test/__snapshots__/index.spec.ts.snap +++ b/src/share-sheet/test/__snapshots__/index.spec.ts.snap @@ -1,5 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`should render cancel slot correctly 1`] = ` + +`; + exports[`should render cancel text when using cancel-text prop 1`] = `