claylevering / vue-composition-converter

Vue composition API converter

Home Page:https://vue-composition-converter-hazel.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vue-composition-converter

https://github.com/fazulk/vue-composition-converter for Nuxt3 project

if you are getting a error (red border) it means your code could have some variable assignments that can't be converted. Such as below:

const varName = 'foo'
this.varName = varName

In this case you need to fix your code before attempting to convert.

convert options into script setup

  • data, computed, watch, methods, lifecycle, props -> setup()
    • data -> ref()
    • computed -> computed()
    • watch -> watch()
    • methods -> function
    • lifecycle -> lifecycle hooks
      • beforeCreate, created -> Immediate function
    • props -> toRefs()

convert this

  • this.prop
    • (toRefs, ref, computed) -> prop.value
    • (other) -> prop
  • this.$globalProp -> ctx.root.$globalProp

Testing a link to THE TOP

About

Vue composition API converter

https://vue-composition-converter-hazel.vercel.app

License:MIT License


Languages

Language:TypeScript 85.8%Language:Vue 8.2%Language:JavaScript 4.9%Language:HTML 0.9%Language:CSS 0.2%