Using vuelidate with Vue 3 : Decorators Issue with composition API (` – Pierre couy May 04 '23 at 08:40

  • I have changed it also. But the issue was not be solved. However, I appreciate your effort. Thanks for it! – Kanchana Kariyawasam May 04 '23 at 10:26
  • 1

    Please check this - Migrating from vue2 with property-decorator and class style syntax to vue3

    I was faced the same issue. I have a huge vue2 project that full built with "vue-property-decorator" and when I decided migrate to vue3 I couldn't do it because "vue-property-decorator" is depricated and doesn't support vue3.

    Here is an issue about it on their GitHub - #294 Vue 3.0 support

    So I had to migrate to vue 2.7 (it allows to write new components using Composition API) and manually rewrite all my project to Composition API, then I was able to migrate it to vue 3.

    But check the first link I provided in the beginning. Seems like they found a way to use "vue-property-decorator" with vue 3.

    AlekseiKrivo
    • 466
    • 6
    1

    You may want to try vue-facing-decorator instead of vue-class-component or vue-property-decorator. It’s now the suggested alternative in the deprecation notices of both packages.

    We’ve found it effective in migrating our class components to Vue 3.

    https://medium.com/@robert.helms1/vue-2-to-vue-3-with-class-components-cdd6530a2b2a

    Penny Liu
    • 15,447
    • 5
    • 79
    • 98
    rdhelms
    • 91
    • 1
    • 6
    • In this article, there is a note that mentioning **in vue 3, class components would be even more supported than in Vue 2** But I noticed in vue migration document, we are not forced to used class component in vue 3. Is it right? – Kanchana Kariyawasam May 09 '23 at 04:46
    • @KanchanaKariyawasam that statement about being “more supported” is talking about how long ago the Vue 3 specs included a native Class API which would support class components without the need for any other package BUT (as mentioned in the article) that idea was abandoned which means we still need to use a package like vue-facing-decorator for class components. – rdhelms May 09 '23 at 11:00
    • 1
      @KanchanaKariyawasam core Vue 3 only officially uses the Options API and the Composition API for components, not class components – rdhelms May 09 '23 at 11:02
    0

    If you're looking to migrate your project from vue-property-decorator to the setup API, here's a suggested approach. First, update your project to Vue 2.7 and then proceed to Vue 3.x.

    To simplify the conversion process, you can utilize a helpful CLI tool called vue-declassify-to-setup. This tool converts vue-property-decorator code to the setup API.

    To access the CLI and facilitate the conversion, you can visit the following npm package page: vue-declassify-to-setup.

    https://www.npmjs.com/package/vue-declassify-to-setup

    I am the author of the vue-declassify-to-setup tool and currently utilizing it to convert approximately 1000 files.

    We chose to convert to the setup API instead of using another property decorator due to its simplicity, standardization, familiarity, typescript and debugging support, and powerful capabilities.