types: using exact component instance type (#9256)

This commit is contained in:
neverland
2021-08-13 09:59:44 +08:00
committed by GitHub
parent f0f2059d91
commit 42888a1c22
14 changed files with 43 additions and 51 deletions
+3 -4
View File
@@ -16,14 +16,13 @@ import {
isMobile,
truthProp,
createNamespace,
ComponentInstance,
} from '../utils';
// Composables
import { useExpose } from '../composables/use-expose';
// Components
import { Area, AreaList, AreaColumnOption } from '../area';
import { Area, AreaList, AreaColumnOption, AreaInstance } from '../area';
import { Cell } from '../cell';
import { Field } from '../field';
import { Popup } from '../popup';
@@ -120,7 +119,7 @@ export default defineComponent({
],
setup(props, { emit, slots }) {
const areaRef = ref<ComponentInstance>();
const areaRef = ref<AreaInstance>();
const state = reactive({
data: {} as AddressEditInfo,
@@ -158,7 +157,7 @@ export default defineComponent({
const assignAreaValues = () => {
if (areaRef.value) {
const detail = areaRef.value.getArea();
const detail: Record<string, string> = areaRef.value.getArea();
detail.areaCode = detail.code;
delete detail.code;
extend(state.data, detail);
+3 -2
View File
@@ -1,7 +1,7 @@
import { PropType, ref, defineComponent } from 'vue';
// Utils
import { isAndroid, ComponentInstance, createNamespace } from '../utils';
import { isAndroid, createNamespace } from '../utils';
// Components
import { Cell } from '../cell';
@@ -9,6 +9,7 @@ import { Field } from '../field';
// Types
import type { AddressEditSearchItem } from './types';
import type { FieldInstance } from '../field/types';
const [name, bem, t] = createNamespace('address-edit-detail');
const android = isAndroid();
@@ -30,7 +31,7 @@ export default defineComponent({
emits: ['blur', 'focus', 'input', 'select-search'],
setup(props, { emit }) {
const field = ref<ComponentInstance>();
const field = ref<FieldInstance>();
const showSearchResult = () =>
props.focused && props.searchResult && props.showSearchResult;