diff --git a/src/action-sheet/test/__snapshots__/index.spec.js.snap b/src/action-sheet/test/__snapshots__/index.spec.js.snap index e27c3187b..a5685dfb5 100644 --- a/src/action-sheet/test/__snapshots__/index.spec.js.snap +++ b/src/action-sheet/test/__snapshots__/index.spec.js.snap @@ -16,6 +16,12 @@ exports[`close-icon prop 1`] = ` `; +exports[`closeable prop 1`] = ` +
+
Title
+
+`; + exports[`color option 1`] = `
`; exports[`description prop 1`] = ` diff --git a/src/collapse-item/index.js b/src/collapse-item/index.js index dd482c7a5..1340dc2b4 100644 --- a/src/collapse-item/index.js +++ b/src/collapse-item/index.js @@ -1,7 +1,7 @@ import { ref, watch, computed, nextTick } from 'vue'; // Utils -import { createNamespace, isDef } from '../utils'; +import { createNamespace } from '../utils'; import { raf, doubleRaf } from '../utils/dom/raf'; // Composition @@ -31,9 +31,7 @@ export default createComponent({ const contentRef = ref(); const { parent, index } = useParent(COLLAPSE_KEY); - const currentName = computed(() => - isDef(props.name) ? props.name : index.value - ); + const currentName = computed(() => props.name ?? index.value); const expanded = computed(() => { if (parent) { diff --git a/src/picker/index.js b/src/picker/index.js index 1049cddf3..afce13dce 100644 --- a/src/picker/index.js +++ b/src/picker/index.js @@ -1,5 +1,5 @@ // Utils -import { createNamespace, isDef } from '../utils'; +import { createNamespace } from '../utils'; import { preventDefault } from '../utils/dom/event'; import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant'; import { pickerProps, DEFAULT_ITEM_HEIGHT } from './shared'; @@ -90,9 +90,7 @@ export default createComponent({ let cursor = { children: this.columns }; while (cursor && cursor.children) { - const defaultIndex = isDef(cursor.defaultIndex) - ? cursor.defaultIndex - : +this.defaultIndex; + const defaultIndex = cursor.defaultIndex ?? +this.defaultIndex; formatted.push({ values: cursor.children, @@ -313,9 +311,7 @@ export default createComponent({ allowHtml={this.allowHtml} className={item.className} itemHeight={this.itemPxHeight} - defaultIndex={ - isDef(item.defaultIndex) ? item.defaultIndex : +this.defaultIndex - } + defaultIndex={item.defaultIndex ?? +this.defaultIndex} swipeDuration={this.swipeDuration} visibleItemCount={this.visibleItemCount} initialOptions={item.values} diff --git a/src/progress/index.js b/src/progress/index.js index acbdcc1f9..612124341 100644 --- a/src/progress/index.js +++ b/src/progress/index.js @@ -1,5 +1,5 @@ import { ref, watch, computed, nextTick, reactive, onMounted } from 'vue'; -import { createNamespace, isDef, addUnit } from '../utils'; +import { createNamespace, addUnit } from '../utils'; const [createComponent, bem] = createNamespace('progress'); @@ -46,7 +46,7 @@ export default createComponent({ const renderPivot = () => { const { rootWidth, pivotWidth } = state; const { textColor, pivotText, pivotColor, percentage } = props; - const text = isDef(pivotText) ? pivotText : percentage + '%'; + const text = pivotText ?? percentage + '%'; const show = props.showPivot && text; if (show) { diff --git a/src/share-sheet/index.js b/src/share-sheet/index.js index 843a95928..673c9ef5b 100644 --- a/src/share-sheet/index.js +++ b/src/share-sheet/index.js @@ -1,5 +1,5 @@ // Utils -import { createNamespace, isDef, pick } from '../utils'; +import { createNamespace, pick } from '../utils'; // Components import Popup, { popupSharedProps } from '../popup'; @@ -102,7 +102,7 @@ export default createComponent({ }; const renderCancelText = () => { - const text = isDef(props.cancelText) ? props.cancelText : t('cancel'); + const text = props.cancelText ?? t('cancel'); if (text) { return (