Giter Club home page Giter Club logo

composition-api-converter's People

Contributors

akryum avatar changjoo-park avatar pikax avatar sendilkumarn avatar ymhr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

composition-api-converter's Issues

Apply for maintaining this project

This is a potential project. In the past two years, Vue has been through many changes.

  • Option API to composition API
  • <script setup> syntactic sugar
  • reactive-transform (coming soon)
  • Vue 2.7 (coming soon)

People need a automated tool to update their old code. I know Vue team is busy at the moment, and the majority of these implementations not difficult to do, just need time. So I wanted to apply to maintain this project, and help Vue team to do the things what I can do.

A little background on me:

  • In the past few months I've been active in vue-next, contributed several times. More often, I help people solve issue
  • One of the maintainers of Vux
  • A Vue fan, with four years of using Vue

I would be greatly honoured if I can help you with something, even if it's experimental. All best wish for happy new year.
@yyx990803 @posva @Akryum

Convert full SFC

I think it would be great to just copy paste the whole file including the template and style sections - then the output file can be a drop-in replacement really, but also could use the template to see what is public/private (basically you could assume private methods and computeds if they are not used in the template)

Drop setup if it's empty

If I pass a component with a prop but without data I'll get an empty object in the setup return.

Input:

export default {
  name: 'MyComponent',
  props: {
    item: Object,
  }
}

Output:

export default {
  name: 'MyComponent',

  props: {
    item: Object
  },

  setup() {
    return {}
  }
}

Should be (probably):

export default {
  name: 'MyComponent',

  props: {
    item: Object
  },

  setup(props) {
    return { ...props }
  }
}

Spread from function return unsupported in object options

Object spread is not currently supported and probably could be handled with some ugly code (unfortunately).

Input:

  const computed = { value() { return this.count + 1;  } };

  export default {
    props: {
      count: Number,
    },
    computed: {
      ...computed,
    }
  }

Could be:

import { computed } from 'vue';

const _computed = { value() { return this.count + 1; } };

export default {
  setup(props, context) {
    const ctx = { ...props, ...context };
    return {
      ...Object.keys(_computed).reduce((acc, key) => {
        acc[key] = computed(_computed[key].bind(ctx))
        return acc;
      }, {})
    }
  }
}

The same applies to methods and data.

Option to pick a preference in how to handle primitives within data object

I would like to be able to choose on how to convert data props to reactive values. There are two methods: value and state and value is the default one now. I would like to pick state instead.

Input:

  export default {
    data() {
      return {
        visible: false,
      }
    },
  }

Current output:

import { value } from 'vue'

export default {
  setup() {
    const visible = value(false)

    return {
      visible
    }
  }
}

Output with state:

import { state } from 'vue'

export default {
  setup() {
    const data = state({ visible: false })

    return {
      ...data
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.