# @vue/babel-sugar-v-model

> 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-model
pnpm add @vue/babel-sugar-v-model
yarn add @vue/babel-sugar-v-model
bun add @vue/babel-sugar-v-model
```

## 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 | 6 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1477 |
| Author | Nick Messing |
| Maintainers | nickmessing, soda, yyx990803 |

## Links

- npm: https://www.npmjs.com/package/@vue/babel-sugar-v-model
- 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-model

## Dependencies (6)

- [svg-tags](https://npm.io/package/svg-tags.md) ^1.0.0
- [camelcase](https://npm.io/package/camelcase.md) ^5.0.0
- [html-tags](https://npm.io/package/html-tags.md) ^2.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
- [@vue/babel-helper-vue-jsx-merge-props](https://npm.io/package/@vue/babel-helper-vue-jsx-merge-props.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.1 — 2019-10-11
- 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-model

Syntactic sugar for v-model 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-model
# for npm:
npm install @vue/babel-sugar-v-model --save
```

In your `.babelrc`:

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

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

### Details

This plugin adds v-model 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 (`vModel_trim={this.test}`)
2.  It is recommended to use camelCase version of it (`vModel`) in JSX, but you can use kebab-case too (`v-model`).

```js
export default {
  data: () => ({
    test: 'Hello World',
  }),
  render(h) {
    return (
      <div>
        <input type="text" vModel_trim={this.test} />
        {this.test}
      </div>
    )
  },
}
```

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