diff --git a/src/action-sheet/ActionSheet.tsx b/src/action-sheet/ActionSheet.tsx index 69c37e552..d22b0ec17 100644 --- a/src/action-sheet/ActionSheet.tsx +++ b/src/action-sheet/ActionSheet.tsx @@ -78,11 +78,11 @@ export default defineComponent({ }; const renderCancel = () => { - if (props.cancelText) { + if (slots.cancel || props.cancelText) { return [
, , ]; } diff --git a/src/action-sheet/README.md b/src/action-sheet/README.md index abcdc2997..51cc76843 100644 --- a/src/action-sheet/README.md +++ b/src/action-sheet/README.md @@ -211,10 +211,11 @@ export default { ### Slots -| Name | Description | -| ----------- | ------------------ | -| default | Custom content | -| description | Custom description | +| Name | Description | +| ---------------- | ------------------------------------ | +| default | Custom content | +| description | Custom description above the options | +| cancel `v3.0.10` | Custom the content of cancel button | ### Less Variables diff --git a/src/action-sheet/README.zh-CN.md b/src/action-sheet/README.zh-CN.md index 5f5b5c130..b239aa02d 100644 --- a/src/action-sheet/README.zh-CN.md +++ b/src/action-sheet/README.zh-CN.md @@ -227,10 +227,11 @@ export default { ### Slots -| 名称 | 说明 | -| ----------- | -------------------- | -| default | 自定义面板的展示内容 | -| description | 自定义描述文案 | +| 名称 | 说明 | +| ---------------- | -------------------- | +| default | 自定义面板的展示内容 | +| description | 自定义描述文案 | +| cancel `v3.0.10` | 自定义取消按钮内容 | ### 样式变量 diff --git a/src/action-sheet/test/__snapshots__/index.spec.ts.snap b/src/action-sheet/test/__snapshots__/index.spec.ts.snap index 8b5c1e035..af511b2a5 100644 --- a/src/action-sheet/test/__snapshots__/index.spec.ts.snap +++ b/src/action-sheet/test/__snapshots__/index.spec.ts.snap @@ -5,6 +5,14 @@ exports[`should allow to custom close icon with closeIcon prop 1`] = ` `; +exports[`should render cancel slot correctly 1`] = ` + +`; + exports[`should render default slot correctly 1`] = `
diff --git a/src/action-sheet/test/index.spec.ts b/src/action-sheet/test/index.spec.ts index 5be48adb0..5cbcae95b 100644 --- a/src/action-sheet/test/index.spec.ts +++ b/src/action-sheet/test/index.spec.ts @@ -182,6 +182,19 @@ test('should render description correctly', () => { ).toMatchSnapshot(); }); +test('should render cancel slot correctly', () => { + const wrapper = mount(ActionSheet, { + props: { + show: true, + }, + slots: { + cancel: () => 'Custom Cancel', + }, + }); + + expect(wrapper.find('.van-action-sheet__cancel').html()).toMatchSnapshot(); +}); + test('should render description slot when match snapshot', () => { const wrapper = mount(ActionSheet, { props: { diff --git a/src/number-keyboard/demo/index.vue b/src/number-keyboard/demo/index.vue index ca28f6ec9..0946da258 100644 --- a/src/number-keyboard/demo/index.vue +++ b/src/number-keyboard/demo/index.vue @@ -1,30 +1,32 @@