Skip to content

Commit 39112fa

Browse files
committed
feat: Vue 2.7 compatibility
1 parent 99603d0 commit 39112fa

File tree

12 files changed

+3389
-6576
lines changed

12 files changed

+3389
-6576
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v2.1.0
2+
3+
> `2022-07-11`
4+
5+
### 🎉 Features
6+
- Vue `2.7` compatibility.
7+
18
## v2.0.2
29

310
> `2022-05-11`

README.md

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -126,52 +126,34 @@ npm install @vueform/toggle
126126

127127
## Using with Vue 2
128128

129-
When using Vue 2 install [@vue/composition-api](https://github.com/vuejs/composition-api#npm) via npm/yarn first:
130-
131-
``` bash
132-
npm i @vue/composition-api --save-dev
133-
```
134-
135-
Then install the plugin for Vue:
136-
137-
``` js
138-
import Vue from 'vue'
139-
import VueCompositionAPI from '@vue/composition-api'
140-
141-
Vue.use(VueCompositionAPI)
142-
```
143-
144-
After that make sure to change the imported Toggle module to:
145-
146-
``` js
147-
import Toggle from '@vueform/toggle/dist/toggle.vue2.js'
148-
```
149-
150-
## Using with Nuxt.js
151-
152-
First you need install [@nuxtjs/composition-api](https://composition-api.nuxtjs.org/getting-started/setup):
129+
``` vue
130+
<template>
131+
<div>
132+
<Toggle v-model="value" />
133+
</div>
134+
</template>
153135
154-
``` bash
155-
npm i @nuxtjs/composition-api --save
156-
```
136+
<script>
137+
import Toggle from '@vueform/toggle/toggle.vue2.js'
157138
158-
Then you need to enable it as a module in `nuxt.config.js`:
139+
export default {
140+
components: {
141+
Toggle,
142+
},
143+
data() {
144+
return {
145+
value: true
146+
}
147+
}
148+
}
149+
</script>
159150
160-
``` js
161-
{
162-
buildModules: [
163-
'@nuxtjs/composition-api/module'
164-
]
165-
}
151+
<style src="@vueform/toggle/themes/default.css"></style>
166152
```
167153

168-
After that make sure to change the imported module to Vue 2 version of Toggle:
169-
170-
``` js
171-
import Toggle from '@vueform/toggle/dist/toggle.vue2'
172-
```
154+
#### Using with < Vue 2.7
173155

174-
For more information on using `@nuxtjs/composition-api` read [their documentation](https://composition-api.nuxtjs.org/).
156+
Switch to [`<= 2.0.2`](https://github.com/vueform/toggle/tree/2.0.2) to use the Toggle with Vue.js `< 2.7`.
175157

176158
## Support
177159

build/vue2.rollup.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default [
1414
vue(),
1515
alias({
1616
entries: [
17-
{ find: 'composition-api', replacement: '@vue/composition-api' },
17+
{ find: 'composition-api', replacement: 'vue' },
1818
]
1919
}),
2020
babel({
@@ -23,7 +23,7 @@ export default [
2323
}),
2424
terser(),
2525
],
26-
external: ['@vue/composition-api'],
26+
external: ['vue'],
2727
},
2828
{
2929
input: 'src/Toggle.vue',
@@ -32,7 +32,7 @@ export default [
3232
format: 'iife',
3333
name: 'VueformToggle',
3434
globals: {
35-
'composition-api': 'VueCompositionAPI',
35+
'composition-api': 'Vue',
3636
'vue': 'Vue',
3737
}
3838
},

dist/toggle.global.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)