vueact/babel-plugin-transform-react-to-vue

Handle constructor

Closed this issue ยท 0 comments

class App extends Component {
  constructor(props) {
    super(props)
    const bar = 'bar'
    this.state = { foo: props.foo + bar }
    this.something = bar
  }
}

Maybe transform to this? not sure ๐Ÿ˜…

const App = {
  data() {
    var props = this.$props
    const bar = 'bar'
    return  { foo: props.foo + bar }
  },
  created() {
    const bar = 'bar'
    this.something = bar
  }
}

Or:

const App = {
  data() {
    var props = this.$props
    const bar = 'bar'
    var __state = { foo: props.foo + bar }
    this.something = bar
    return __state
  }
}