diff --git a/docs/component/datetime-picker.md b/docs/component/datetime-picker.md index e1fed8876..97eaeca52 100644 --- a/docs/component/datetime-picker.md +++ b/docs/component/datetime-picker.md @@ -252,6 +252,48 @@ const displayFormatTabLabel = (items) => { } ``` +## 自定义icon + +通过 `icon`插槽自定义icon。 + +```html + + + +``` + +```typescript +const value18 = ref('') +/* computed */ +const iconName = computed(() => { + return value18.value ? 'error-fill' : 'arrow-right' +}) +const clear = () => { + if (iconName.value === 'arrow-right') { + return + } + value18.value = '' +} +``` + +## 自定义展示文案 + +给 `display-format` 属性传入一个函数,接收所有选中项数组,返回展示的文本内容。 + +```html + +``` + +```typescript +const value = ref('') + +function handleConfirm({ value }) { + +} + + ## Attributes @@ -326,6 +368,7 @@ const displayFormatTabLabel = (items) => { |------|-----|---------| | default | 使用默认插槽 | - | | label | 左侧标题插槽 | - | +| icon | 图标插槽 | {disabled, readonly} ,{是否禁用,是否只读} | ## 外部样式类 diff --git a/src/pages/datetimePicker/Index.vue b/src/pages/datetimePicker/Index.vue index 7c4e5cc6a..41772e09f 100644 --- a/src/pages/datetimePicker/Index.vue +++ b/src/pages/datetimePicker/Index.vue @@ -33,6 +33,13 @@ + + + + +