types: improve ref typing (#8182)

This commit is contained in:
neverland
2021-02-19 20:58:02 +08:00
committed by GitHub
parent 7daca89102
commit 9ad0eafae0
9 changed files with 31 additions and 20 deletions
+3 -3
View File
@@ -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<ComponentInstance>();
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 = () => {
+2 -2
View File
@@ -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<ComponentInstance>();
const state = reactive({
data: {} as AddressInfo,