0.1.3 • Published 2 years ago

unplugin-vue2-vmodel v0.1.3

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

unplugin-starter

NPM version

Usage

To use this template, clone it down using:

npm install unplugin-vue2-vmodel

before

<script lang="ts" setup>
const name = ref('')
</script>

<template>
  <div>
    <a-input v-model:value="name" />
    <a-input v-model:test="name" />
    <a-input v-model:test1 ="name" />
  </div>
</template>

after

<script lang="ts" setup>
const name = ref('')
</script>

<template>
  <div>
    <a-input v-model="name" />
    <a-input :test.sync="name" />
    <a-input :test1.sync="name" />
  </div>
</template>

Install

npm i unplugin-starter
// vite.config.ts
import Vmodel from 'unplugin-vue2-vmodel/vite'

export default defineConfig({
  plugins: [
    Vmodel({ /* options */ }),
  ],
})

// rollup.config.js
import Vmodel from 'unplugin-vue2-vmodel/rollup'

export default {
  plugins: [
    Vmodel({ /* options */ }),
  ],
}

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-vue2-vmodel/webpack')({ /* options */ })
  ]
}

// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-vue2-vmodel/nuxt', { /* options */ }],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-vue2-vmodel/webpack')({ /* options */ }),
    ],
  },
}

// esbuild.config.js
import { build } from 'esbuild'
import Vmodel from 'unplugin-vue2-vmodel/esbuild'

build({
  plugins: [Vmodel()],
})