diff --git a/src/address-edit/Detail.tsx b/src/address-edit/Detail.tsx index ed5c431a6..40b2193b8 100644 --- a/src/address-edit/Detail.tsx +++ b/src/address-edit/Detail.tsx @@ -1,7 +1,7 @@ import { PropType, ref } from 'vue'; // Utils -import { createNamespace } from '../utils'; +import { ComponentInstance, createNamespace } from '../utils'; import { isAndroid } from '../utils/validate/system'; // Components @@ -31,7 +31,7 @@ export default createComponent({ emits: ['blur', 'focus', 'input', 'select-search'], setup(props, { emit }) { - const field = ref(); + const field = ref(); const showSearchResult = () => props.focused && props.searchResult && props.showSearchResult; @@ -42,7 +42,7 @@ export default createComponent({ }; const onFinish = () => { - field.value.blur(); + field.value!.blur(); }; const renderFinish = () => { diff --git a/src/address-edit/index.tsx b/src/address-edit/index.tsx index dc855da1a..deecf2532 100644 --- a/src/address-edit/index.tsx +++ b/src/address-edit/index.tsx @@ -1,7 +1,7 @@ import { ref, watch, computed, nextTick, reactive, PropType } from 'vue'; // Utils -import { createNamespace, isObject } from '../utils'; +import { ComponentInstance, createNamespace, isObject } from '../utils'; import { isMobile } from '../utils/validate/mobile'; // Composition @@ -113,7 +113,7 @@ export default createComponent({ ], setup(props, { emit, slots }) { - const areaRef = ref(); + const areaRef = ref(); const state = reactive({ data: {} as AddressInfo, diff --git a/src/calendar/components/Month.tsx b/src/calendar/components/Month.tsx index b2bb67e82..bc1cb0626 100644 --- a/src/calendar/components/Month.tsx +++ b/src/calendar/components/Month.tsx @@ -55,8 +55,8 @@ export default createComponent({ setup(props, { emit }) { const [visible, setVisible] = useToggle(); - const daysRef = ref(); - const monthRef = ref(); + const daysRef = ref(); + const monthRef = ref(); const height = useHeight(monthRef); const title = computed(() => formatMonthTitle(props.date)); @@ -82,7 +82,7 @@ export default createComponent({ const el = props.showSubtitle ? daysRef.value : monthRef.value; const scrollTop = - el.getBoundingClientRect().top - + el!.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop; diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index 591b419e4..dd4ca481e 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -174,7 +174,7 @@ export default createComponent({ let bodyHeight: number; - const bodyRef = ref(); + const bodyRef = ref(); const state = reactive({ subtitle: '', @@ -219,7 +219,7 @@ export default createComponent({ // calculate the position of the elements // and find the elements that needs to be rendered const onScroll = () => { - const top = getScrollTop(bodyRef.value); + const top = getScrollTop(bodyRef.value!); const bottom = top + bodyHeight; const heights = months.value.map((item, index) => diff --git a/src/datetime-picker/DatePicker.tsx b/src/datetime-picker/DatePicker.tsx index 4b07091bd..0523b37cb 100644 --- a/src/datetime-picker/DatePicker.tsx +++ b/src/datetime-picker/DatePicker.tsx @@ -2,7 +2,13 @@ import { ref, watch, computed, nextTick, onMounted, PropType } from 'vue'; // Utils import { isDate } from '../utils/validate/date'; -import { pick, range, padZero, createNamespace } from '../utils'; +import { + pick, + range, + padZero, + createNamespace, + ComponentInstance, +} from '../utils'; import { times, ColumnType, @@ -57,7 +63,7 @@ export default createComponent({ return props.minDate; }; - const picker = ref(); + const picker = ref(); const currentDate = ref(formatValue(props.modelValue)); const getBoundary = (type: 'max' | 'min', value: Date) => { @@ -207,13 +213,13 @@ export default createComponent({ }); nextTick(() => { - picker.value.setValues(values); + picker.value!.setValues(values); }); }; const updateInnerValue = () => { const { type } = props; - const indexes = picker.value.getIndexes(); + const indexes = picker.value!.getIndexes(); const getValue = (type: ColumnType) => { let index = 0; diff --git a/src/index-anchor/index.tsx b/src/index-anchor/index.tsx index 365536c44..7e1b400e3 100644 --- a/src/index-anchor/index.tsx +++ b/src/index-anchor/index.tsx @@ -26,7 +26,7 @@ export default createComponent({ active: false, }); - const root = ref(); + const root = ref(); const { parent } = useParent(INDEX_BAR_KEY); if (!parent) { diff --git a/src/index-bar/index.tsx b/src/index-bar/index.tsx index 4ee6c998e..0c6b3f53d 100644 --- a/src/index-bar/index.tsx +++ b/src/index-bar/index.tsx @@ -75,7 +75,7 @@ export default createComponent({ setup(props, { emit, slots }) { const root = ref(); - const activeAnchor = ref(); + const activeAnchor = ref(''); const touch = useTouch(); const scrollParent = useScrollParent(root); diff --git a/src/search/index.tsx b/src/search/index.tsx index c810c8c73..01dcf6a4a 100644 --- a/src/search/index.tsx +++ b/src/search/index.tsx @@ -1,7 +1,12 @@ import { ref, PropType, CSSProperties } from 'vue'; // Utils -import { pick, createNamespace, preventDefault } from '../utils'; +import { + pick, + createNamespace, + preventDefault, + ComponentInstance, +} from '../utils'; // Composition import { useExpose } from '../composables/use-expose'; @@ -44,7 +49,7 @@ export default createComponent({ emits: ['update:modelValue', 'search', 'cancel'], setup(props, { emit, slots, attrs }) { - const filedRef = ref(); + const filedRef = ref(); const onCancel = () => { if (!slots.action) { diff --git a/src/tabs/TabsContent.tsx b/src/tabs/TabsContent.tsx index 3ebd4066a..6699dbd1f 100644 --- a/src/tabs/TabsContent.tsx +++ b/src/tabs/TabsContent.tsx @@ -1,5 +1,5 @@ import { ref, watch, onMounted } from 'vue'; -import { createNamespace } from '../utils'; +import { ComponentInstance, createNamespace } from '../utils'; import Swipe from '../swipe'; const [createComponent, bem] = createNamespace('tabs'); @@ -27,7 +27,7 @@ export default createComponent({ emits: ['change'], setup(props, { emit, slots }) { - const swipeRef = ref(); + const swipeRef = ref(); const onChange = (index: number) => { emit('change', index);