element-ui-types
v0.3.3
Published
ElementUI typescript definition, element ui types
Downloads
184
Maintainers
Readme
Provide types support for ElementUI under Volar.
Install and usage
1. Install element-ui-types
npm i element-ui-types -D
# Or
pnpm add element-ui-types -D
2. Add the following configuration to tsconfig.json
// tsconfig.json
{
"vueCompilerOptions": {
"target": 2.7,
// "target": 2, // For Vue version <= 2.6.14
},
"compilerOptions": {
"types": ["element-ui-types"]
}
}
3. Reload IDE
Demo
<template>
<ElForm ref="formRef">
...
</ElForm>
</template>
<script lang="ts" setup>
import { type Form } from 'element-ui'
const formRef = ref<InstanceType<typeof Form>>()
formRef.value?.validate(valid => {
// `valid` is type of `boolean`
})
</script>