0.0.4 • Published 2 months ago

@juyou/vue2react v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

vue2react

A tool that transforms Vue component to React component.

Now support tranform SFC (.vue) file.

There are 2 ways to use the transform tool: web page or cli.

Web Page

https://mcuking.github.io/vue2react/

To get better perfomance, suggest access to it via Chrome.

The demo screen is here.

CLI

Install

npm i vue2react -g

or

yarn add vue2react -g

Usage

bash example

vtr -i hello.vue -o ./screen -n nihao.js
vtr hello.vue ./screen nihao.js
vtr hello.vue

vtr help infomation

Usage: vtr [options]

Options:
  -V, --version  output the version number
  -i, --input    the input path for vue component
  -o, --output   the output path for react component, which default value is process.cwd()
  -n, --name     the output file name, which default value is "react.js"
  -h, --help     output usage information

Support

  • Data
    • data
    • props
    • propsData
    • computed
    • methods
    • watch
  • DOM
    • el
    • template
    • render
    • renderError
  • Lifecycle Hooks
    • created
    • mounted
    • updated
    • beforeDestroy
    • errorCaptured
  • Directives
    • v-text
    • v-html
    • v-show
    • v-if
    • v-else
    • v-else-if
    • v-for
    • v-on / @
    • v-bind / :
    • v-model
    • v-pre
    • v-cloak
    • v-once
  • Special Attributes
    • key
    • ref

Example

Demo1

Demo2

Inspiration

algorithm-visualizer

vue-to-react