TypeScript Support
VEUI provides TS declarations for component APIs, which require Volar for the best development experience.
Configure Volar extension
Please refer to the Volar documentation on Setup for Vue2
.
For Vue versions < 2.7, @vue/runtime-dom
needs to be installed:
npm i -D @vue/runtime-dom
Local configuration
Add the following configuration to tsconfig.json
to support Vue 2's template syntax.
// tsconfig.json
{
"compilerOptions": {
// ...
},
"vueCompilerOptions": {
"target": 2.7,
// "target": 2, // for Vue versions < 2.7
}
}
Usage example
<template>
<veui-button>OK</veui-button>
</template>
<script lang="ts">
import { defineComponent } from 'vue' // < 2.7 versions require `@vue/composition-api`
import { Button } from 'veui'
export default defineComponent({
components: {
'veui-button': Button
}
})
</script>