# @vue/babel-sugar-v-on

> Babel syntactic sugar for v-model support in Vue JSX

Latest version **1.4.0** (published 2022-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vue/babel-sugar-v-on
pnpm add @vue/babel-sugar-v-on
yarn add @vue/babel-sugar-v-on
bun add @vue/babel-sugar-v-on
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2022-08-25 |
| First published | 2018-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1476 |
| Author | Nick Messing |
| Maintainers | nickmessing, soda, yyx990803 |

## Links

- npm: https://www.npmjs.com/package/@vue/babel-sugar-v-on
- Repository: https://github.com/vuejs/jsx.git#master
- Homepage: https://github.com/vuejs/jsx/tree/master#readme
- Issues: https://github.com/vuejs/jsx/issues
- npm.io page: https://npm.io/package/@vue/babel-sugar-v-on

## Dependencies (3)

- [camelcase](https://npm.io/package/camelcase.md) ^5.0.0
- [@babel/plugin-syntax-jsx](https://npm.io/package/@babel/plugin-syntax-jsx.md) ^7.2.0
- [@vue/babel-plugin-transform-vue-jsx](https://npm.io/package/@vue/babel-plugin-transform-vue-jsx.md) ^1.4.0

## Recent versions

- 1.4.0 (latest) — 2022-08-25
- 1.3.0 — 2022-07-06
- 1.2.3 — 2020-10-20
- 1.2.1 — 2020-10-16
- 1.2.0 — 2020-10-16
- 1.1.2 — 2019-11-09
- 1.1.0 — 2019-07-23
- 1.0.0 — 2019-05-08
- 1.0.0-beta.3 — 2019-03-22
- 1.0.0-beta.2 — 2019-01-11
- 1.0.0-beta.1 — 2018-12-25
- 0.1.0 — 2018-08-27

## README

## @vue/babel-sugar-v-on

Syntactic sugar for v-on in JSX.

### Babel Compatibility Notes

- This repo is only compatible with Babel 7.x, for 6.x please use [vuejs/babel-plugin-transform-vue-jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx)

### Usage

Install the dependencies:

```sh
# for yarn:
yarn add @vue/babel-sugar-v-on
# for npm:
npm install @vue/babel-sugar-v-on --save
```

In your `.babelrc`:

```json
{
  "plugins": ["@vue/babel-sugar-v-on"]
}
```

However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.

### Details

This plugin adds v-on to the JSX and tries to mirror the same behaviour as in vue-template-compiler, with a few differences:

1.  You should use underscore (`_`) instead of dot (`.`) for modifiers (`vOn:click_prevent={this.test}`)
2.  It is recommended to use camelCase version of it (`vOn`) in JSX, but you can use kebab-case too (`v-on`).

```js
export default {
  methods: {
    test() {
      console.log('Hello World')
    },
  },
  render(h) {
    return (
      <div>
        <a href="https://vuejs.org" vOn:click={this.test}>Vue</a>
      </div>
    )
  },
}
```

---
_Source: https://npm.io/package/@vue/babel-sugar-v-on · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
