Skip to content

What's the level of support for Vue 2? #740

Answered by johnsoncodehk
rchl asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for late to reply! vue-i18n already provided global properties types for vue2, to include it, you need to config "types": [..., "vue-i18n/types"] to compilerOptions in tsconfig, and export the component by Vue.extend or defineComponent from @vue/composition-api.

{
  "compilerOptions": {
    // ...
    "types": [..., "vue-i18n/types"]
  },
  // ...
}
<template>{{ $t }}</template>

<script lang="ts">
import Vue from 'vue';

export default Vue.extend({ ... });
</script>

or

<template>{{ $t }}</template>

<script lang="ts">
import { defineComponent } from '@vue/composition-api';

export default defineComponent({ ... });
</script>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rchl
Comment options

rchl Jan 18, 2022
Collaborator Author

Answer selected by johnsoncodehk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants