@vue/babel-sugar-v-on
Babel syntactic sugar for v-model support in Vue JSX
Last updated 2 years ago by soda .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @vue/babel-sugar-v-on 
SYNC missed versions from official npm registry.

@vue/babel-sugar-v-on

Syntactic sugar for v-on in JSX.

Babel Compatibility Notes

Usage

Install the dependencies:

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

In your .babelrc:

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

However it is recommended to use the configurable preset 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).
export default {
  methods: {
    test() {
      console.log('Hello World')
    },
  },
  render(h) {
    return (
      <div>
        <a href="https://vuejs.org" vOn:click={this.test}>Vue</a>
      </div>
    )
  },
}

Current Tags

  • 1.4.0                                ...           latest (2 years ago)

12 Versions

  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.3                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
  • 1.0.0-beta.3                                ...           6 years ago
  • 1.0.0-beta.2                                ...           6 years ago
  • 1.0.0-beta.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (16)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |