Skip to content

Commit

Permalink
fix: remove unnecessary inheritAttrs prop and update way of import type
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Jul 5, 2021
1 parent b36665f commit 72522ba
Show file tree
Hide file tree
Showing 52 changed files with 201 additions and 135 deletions.
5 changes: 3 additions & 2 deletions packages/varlet-ui/src/action-sheet/ActionSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@
import Ripple from '../ripple'
import Popup from '../popup'
import Icon from '../icon'
import { defineComponent, ref, Ref, watch } from 'vue'
import { defineComponent, ref, watch } from 'vue'
import { props } from './props'
import { dt } from '../utils/shared'
import { pack } from '../locale'
import { ActionItem } from './index'
import type { Ref } from 'vue'
import type { ActionItem } from './index'
export default defineComponent({
name: 'VarActionSheet',
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/back-top/BackTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
</div>
</template>
<script lang="ts">
import { defineComponent, ref, Ref, onMounted, onBeforeUnmount } from 'vue'
import { defineComponent, ref, onMounted, onBeforeUnmount } from 'vue'
import Button from '../button'
import Icon from '../icon'
import { props } from './props'
import { isString, easeInOutCubic, throttle, toNumber } from '../utils/shared'
import { getScrollTop, getScrollLeft, scrollTo } from '../utils/elements'
import type { Ref } from 'vue'
export default defineComponent({
name: 'VarBackTop',
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/badge/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
</template>

<script lang="ts">
import { computed, ComputedRef, defineComponent } from 'vue'
import { computed, defineComponent } from 'vue'
import { props } from './props'
import Icon from '../icon'
import { toNumber } from '../utils/shared'
import type { ComputedRef } from 'vue'
export default defineComponent({
name: 'VarBadge',
Expand Down
9 changes: 6 additions & 3 deletions packages/varlet-ui/src/checkbox-group/CheckboxGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@

<script lang="ts">
import FormDetails from '../form-details'
import { defineComponent, computed, ComputedRef, watch, nextTick } from 'vue'
import { props, ValidateTriggers } from './props'
import { defineComponent, computed, watch, nextTick } from 'vue'
import { props } from './props'
import { useValidation } from '../utils/components'
import { CheckboxGroupProvider, useCheckboxes } from './provide'
import { useCheckboxes } from './provide'
import { useForm } from '../form/provide'
import { uniq } from '../utils/shared'
import type { ComputedRef } from 'vue'
import type { ValidateTriggers } from './props'
import type { CheckboxGroupProvider } from './provide'
export default defineComponent({
name: 'VarCheckboxGroup',
Expand Down
12 changes: 7 additions & 5 deletions packages/varlet-ui/src/checkbox/Checkbox.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="var-checkbox__wrap" @click="handleClick" v-bind="$attrs">
<div class="var-checkbox__wrap" @click="handleClick">
<div class="var-checkbox">
<div
class="var-checkbox__action"
Expand Down Expand Up @@ -50,11 +50,14 @@
import Icon from '../icon'
import Ripple from '../ripple'
import FormDetails from '../form-details'
import { defineComponent, ref, Ref, computed, ComputedRef, watch, nextTick } from 'vue'
import { props, ValidateTriggers } from './props'
import { defineComponent, ref, computed, watch, nextTick } from 'vue'
import { props } from './props'
import { useValidation } from '../utils/components'
import { CheckboxProvider, useCheckboxGroup } from './provide'
import { useCheckboxGroup } from './provide'
import { useForm } from '../form/provide'
import type { Ref, ComputedRef } from 'vue'
import type { ValidateTriggers } from './props'
import type { CheckboxProvider } from './provide'
export default defineComponent({
name: 'VarCheckbox',
Expand All @@ -63,7 +66,6 @@ export default defineComponent({
[Icon.name]: Icon,
[FormDetails.name]: FormDetails,
},
inheritAttrs: false,
props,
setup(props) {
const value: Ref<any> = ref(false)
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/chip/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

<script lang="ts">
import Icon from '../icon'
import { defineComponent, computed, ComputedRef } from 'vue'
import { defineComponent, computed } from 'vue'
import { props } from './props'
import type { ComputedRef } from 'vue'
export default defineComponent({
name: 'VarChip',
Expand Down
10 changes: 5 additions & 5 deletions packages/varlet-ui/src/col/Col.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
paddingLeft: toSizeUnit(padding.left),
paddingRight: toSizeUnit(padding.right)
}"
v-bind="$attrs"
@click="onClick"
>
<slot />
</div>
</template>

<script lang="ts">
import { defineComponent, ref, Ref, computed, ComputedRef, watch } from 'vue'
import { defineComponent, ref, computed, watch } from 'vue'
import { toNumber } from '../utils/shared'
import { props } from './props'
import { ColPadding, ColProvider, useRow } from './provide'
import { useRow } from './provide'
import { toSizeUnit } from '../utils/elements'
import type { Ref, ComputedRef } from 'vue'
import type { ColPadding, ColProvider } from './provide'
export default defineComponent({
name: 'VarCol',
inheritAttrs: false,
props,
setup(props) {
const padding: Ref<ColPadding> = ref({ left: 0, right: 0 })
Expand All @@ -51,7 +51,7 @@ export default defineComponent({
return {
padding,
toNumber,
toSizeUnit,
toSizeUnit
}
}
})
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/collapse-item/CollapseItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
</template>

<script lang="ts">
import { defineComponent, ref, Ref, nextTick, watch, ComputedRef, computed } from 'vue'
import { defineComponent, ref, nextTick, watch, computed } from 'vue'
import { requestAnimationFrame } from '../utils/elements'
import { isArray } from '../utils/shared'
import { CollapseItemProvider, useCollapse } from './provide'
import { useCollapse } from './provide'
import { props } from './props'
import Icon from '../icon'
import type { Ref, ComputedRef } from 'vue'
import type { CollapseItemProvider } from './provide'
export default defineComponent({
name: 'VarCollapseItem',
Expand Down
8 changes: 5 additions & 3 deletions packages/varlet-ui/src/collapse/Collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
</template>

<script lang="ts">
import { computed, ComputedRef, defineComponent, nextTick, watch } from 'vue'
import { CollapseProvider, useCollapseItem } from './provide'
import { CollapseItemProvider } from '../collapse-item/provide'
import { computed, defineComponent, nextTick, watch } from 'vue'
import { useCollapseItem } from './provide'
import { props } from './props'
import { isArray } from '../utils/shared'
import type { ComputedRef } from 'vue'
import type { CollapseItemProvider } from '../collapse-item/provide'
import type { CollapseProvider } from './provide'
export default defineComponent({
name: 'VarCollapse',
Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/context/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
onUnmounted,
onDeactivated,
onActivated,
getCurrentInstance,
ComponentInternalInstance
getCurrentInstance
} from 'vue'
import type { ComponentInternalInstance } from 'vue'
import context from '.'

export function resolveLock() {
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/countdown/Countdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
</template>

<script lang="ts">
import { defineComponent, Ref, ref, watch } from 'vue'
import { defineComponent, ref, watch } from 'vue'
import { props } from './props'
import { requestAnimationFrame, cancelAnimationFrame } from '../utils/elements'
import { toNumber, parseFormat, Time } from '../utils/shared'
import { toNumber, parseFormat } from '../utils/shared'
import type { Ref } from 'vue'
import type { Time } from '../utils/shared'
const SECOND = 1000
const MINUTE = 60 * SECOND
Expand Down
8 changes: 5 additions & 3 deletions packages/varlet-ui/src/counter/Counter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@
import Icon from '../icon'
import Ripple from '../ripple'
import FormDetails from '../form-details'
import { defineComponent, ref, Ref, watch, computed, ComputedRef, nextTick } from 'vue'
import { defineComponent, ref, watch, computed, nextTick } from 'vue'
import { Decimal } from 'decimal.js'
import { props, ValidateTriggers } from './props'
import { props } from './props'
import { toNumber } from '../utils/shared'
import { toSizeUnit } from '../utils/elements'
import { CounterProvider } from './provide'
import { useForm } from '../form/provide'
import { useValidation } from '../utils/components'
import type { Ref, ComputedRef } from 'vue'
import type { ValidateTriggers } from './props'
import type { CounterProvider } from './provide'
const SPEED = 100
const DELAY = 600
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/date-picker/DatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@
</template>

<script lang="ts">
import { defineComponent, Ref, ref, computed, ComputedRef, reactive, UnwrapRef, watch } from 'vue'
import { defineComponent, ref, computed, reactive, watch } from 'vue'
import dayjs from 'dayjs'
import MonthPickerPanel from './src/month-picker-panel.vue'
import YearPickerPanel from './src/year-picker-panel.vue'
import DayPickerPanel from './src/day-picker-panel.vue'
import { props, Month, MONTH_LIST, Choose, Preview, WEEK_HEADER, Week, ComponentProps } from './props'
import { props, MONTH_LIST, WEEK_HEADER } from './props'
import { isArray, toNumber } from '../utils/shared'
import { pack } from '../locale'
import type { Ref, ComputedRef, UnwrapRef } from 'vue'
import type { Month, Choose, Preview, Week, ComponentProps } from './props'
export default defineComponent({
name: 'VarDatePicker',
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/date-picker/src/day-picker-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@
</template>

<script lang="ts">
import { defineComponent, Ref, ref, PropType, computed, ComputedRef, watch, onMounted, UnwrapRef, reactive } from 'vue'
import { defineComponent, ref, computed, watch, onMounted, reactive } from 'vue'
import dayjs from 'dayjs'
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'
import PanelHeader from './panel-header.vue'
import Button from '../../button'
import { WEEK_HEADER, Choose, Preview, ComponentProps, Week, PanelBtnDisabled } from '../props'
import { WEEK_HEADER } from '../props'
import { toNumber } from '../../utils/shared'
import { pack } from '../../locale'
import type { Ref, ComputedRef, UnwrapRef, PropType } from 'vue'
import type { Choose, Preview, ComponentProps, Week, PanelBtnDisabled } from '../props'
dayjs.extend(isSameOrBefore)
dayjs.extend(isSameOrAfter)
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/date-picker/src/month-picker-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
</template>

<script lang="ts">
import { defineComponent, Ref, ref, PropType, computed, ComputedRef, reactive, watch, UnwrapRef } from 'vue'
import { defineComponent, ref, computed, reactive, watch } from 'vue'
import dayjs from 'dayjs'
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'
import { MONTH_LIST, Choose, Month, Preview, ComponentProps, PanelBtnDisabled } from '../props'
import { MONTH_LIST } from '../props'
import PanelHeader from './panel-header.vue'
import Button from '../../button'
import { toNumber } from '../../utils/shared'
import { pack } from '../../locale'
import type { Ref, ComputedRef, UnwrapRef, PropType } from 'vue'
import type { Choose, Preview, ComponentProps, Month, PanelBtnDisabled } from '../props'
dayjs.extend(isSameOrBefore)
dayjs.extend(isSameOrAfter)
Expand Down
5 changes: 3 additions & 2 deletions packages/varlet-ui/src/date-picker/src/panel-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
</template>

<script lang="ts">
import { defineComponent, Ref, ref, computed, ComputedRef, watch, PropType } from 'vue'
import { defineComponent, ref, computed, watch } from 'vue'
import Button from '../../button'
import Icon from '../../icon'
import { Preview, PanelBtnDisabled } from '../props'
import { toNumber } from '../../utils/shared'
import { pack } from '../../locale'
import type { Ref, ComputedRef, PropType } from 'vue'
import type { Preview, PanelBtnDisabled } from '../props'
export default defineComponent({
name: 'PanelHeader',
Expand Down
5 changes: 3 additions & 2 deletions packages/varlet-ui/src/date-picker/src/year-picker-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
</template>

<script lang="ts">
import { defineComponent, computed, ComputedRef, onMounted, PropType } from 'vue'
import { defineComponent, computed, onMounted } from 'vue'
import dayjs from 'dayjs'
import { ComponentProps } from '../props'
import { toNumber } from '../../utils/shared'
import type { ComputedRef, PropType } from 'vue'
import type { ComponentProps } from '../props'
export default defineComponent({
name: 'YearPickerPanel',
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/dialog/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@
import Popup from '../popup'
import Button from '../button'
import { props } from './props'
import { defineComponent, ref, Ref, watch } from 'vue'
import { defineComponent, ref, watch } from 'vue'
import { dt } from '../utils/shared'
import { pack } from '../locale'
import type { Ref } from 'vue'
export default defineComponent({
name: 'VarDialog',
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/form/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
</template>

<script lang="ts">
import { defineComponent, computed, ComputedRef } from 'vue'
import { defineComponent, computed } from 'vue'
import { props } from './props'
import { FormProvider, useFormItems } from './provide'
import { useFormItems } from './provide'
import type { ComputedRef } from 'vue'
import type { FormProvider } from './provide'
export default defineComponent({
name: 'VarForm',
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/icon/Icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
</template>

<script lang="ts">
import { defineComponent, watch, ref, Ref, nextTick } from 'vue'
import { defineComponent, watch, ref, nextTick } from 'vue'
import { isURL, toNumber } from '../utils/shared'
import { props } from './props'
import { toSizeUnit } from '../utils/elements'
import type { Ref } from 'vue'
export default defineComponent({
name: 'VarIcon',
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/image-preview/ImagePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ import Swipe from '../swipe'
import SwipeItem from '../swipe-item'
import Icon from '../icon'
import Popup from '../popup'
import { defineComponent, ref, computed, Ref, ComputedRef, watch } from 'vue'
import { defineComponent, ref, computed, watch } from 'vue'
import { props } from './props'
import { toNumber } from '../utils/shared'
import type { Ref, ComputedRef } from 'vue'
type VarTouch = {
clientX: number
Expand Down
3 changes: 2 additions & 1 deletion packages/varlet-ui/src/image/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@

<script lang="ts">
import Ripple from '../ripple'
import Lazy, { LazyHTMLElement } from '../lazy'
import Lazy from '../lazy'
import { defineComponent } from 'vue'
import { props } from './props'
import { toSizeUnit } from '../utils/elements'
import type { LazyHTMLElement } from '../lazy'
export default defineComponent({
name: 'VarImage',
Expand Down
6 changes: 4 additions & 2 deletions packages/varlet-ui/src/index-anchor/IndexAnchor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
</template>

<script lang="ts">
import { computed, ComputedRef, defineComponent, ref, Ref, RendererNode, Transition } from 'vue'
import { computed, defineComponent, ref, RendererNode, Transition } from 'vue'
import Sticky from '../sticky'
import { IndexAnchorProvider, useIndexBar } from './provide'
import { useIndexBar } from './provide'
import { props } from './props'
import type { Ref, ComputedRef } from 'vue'
import type { IndexAnchorProvider } from './provide'
export default defineComponent({
name: 'VarIndexAnchor',
Expand Down
Loading

0 comments on commit 72522ba

Please sign in to comment.