0.0.3 • Published 5 years ago

@razors/babel-plugin-vue-next-unwrap-ref v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

babel-plugin-vue-next-unwrap-ref

Auto unwrap vue-next's ref variables to ref.value in both SFC and JSX!

Example:

import {ref} from 'vue'
export default () {
  const isShow = ref(false)
  return (
    <div v-show={isShow}></div>
  )
}

You don't need to write isShow.value anymore!

Install

install in npm

npm install @razors/babel-plugin-vue-next-unwrap-ref

or in yarn

yarn add @razors/babel-plugin-vue-next-unwrap-ref

change your babel config

{
    "presets": [
      ["@babel/preset-env"],
    ],
    "plugins": [
      ["@razors/babel-plugin-vue-next-unwrap-ref"]
    ]
}

Tips

  • Ref values which are not in current .vue file will not be transformed.