mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types: reduce any
This commit is contained in:
parent
6e5329cbe0
commit
7f4651bbbf
@ -1,10 +1,11 @@
|
|||||||
|
import { ComponentInstance } from '../utils';
|
||||||
import { watch, inject } from 'vue';
|
import { watch, inject } from 'vue';
|
||||||
|
|
||||||
export const FORM_KEY = 'vanForm';
|
export const FORM_KEY = 'vanForm';
|
||||||
export const FIELD_KEY = 'vanField';
|
export const FIELD_KEY = 'vanField';
|
||||||
|
|
||||||
export function useLinkField(getValue: () => unknown) {
|
export function useLinkField(getValue: () => unknown) {
|
||||||
const field = inject(FIELD_KEY, null) as any;
|
const field = inject(FIELD_KEY, null) as ComponentInstance | null;
|
||||||
|
|
||||||
if (field && !field.childFieldValue.value) {
|
if (field && !field.childFieldValue.value) {
|
||||||
field.childFieldValue.value = getValue;
|
field.childFieldValue.value = getValue;
|
||||||
|
@ -7,7 +7,13 @@ import {
|
|||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { isDef, addUnit, inBrowser, createNamespace } from '../utils';
|
import {
|
||||||
|
isDef,
|
||||||
|
addUnit,
|
||||||
|
inBrowser,
|
||||||
|
createNamespace,
|
||||||
|
ComponentInstance,
|
||||||
|
} from '../utils';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('image');
|
const [createComponent, bem] = createNamespace('image');
|
||||||
@ -51,7 +57,7 @@ export default createComponent({
|
|||||||
const imageRef = ref<HTMLElement>();
|
const imageRef = ref<HTMLElement>();
|
||||||
|
|
||||||
// TODO: types
|
// TODO: types
|
||||||
const { $Lazyload } = getCurrentInstance()!.proxy as any;
|
const { $Lazyload } = getCurrentInstance()!.proxy as ComponentInstance;
|
||||||
|
|
||||||
const style = computed(() => {
|
const style = computed(() => {
|
||||||
const style: CSSProperties = {};
|
const style: CSSProperties = {};
|
||||||
|
@ -109,7 +109,7 @@ export default createComponent({
|
|||||||
if (status === 'normal') {
|
if (status === 'normal') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return (props as any)[`${status}Text`] || t(status);
|
return props[`${status}Text` as const] || t(status);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderStatus = () => {
|
const renderStatus = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user