https://github.com/fringers/vue-deprecate
https://github.com/fringers/vue-deprecate
property-decorators vue vue-plugin vuejs
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fringers/vue-deprecate
- Owner: fringers
- License: mit
- Created: 2020-06-26T15:05:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-25T05:22:25.000Z (about 1 year ago)
- Last Synced: 2025-06-27T14:45:16.316Z (6 months ago)
- Topics: property-decorators, vue, vue-plugin, vuejs
- Language: TypeScript
- Homepage:
- Size: 352 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-deprecate

## Installation
```
npm install vue-deprecate
```
## Setup
### Default setup
```js
import Vue from 'vue';
import VueDeprecate from 'vue-deprecate';
Vue.use(VueDeprecate);
```
### Nuxt.js setup
Create file `plugins/vue-deprecate.js`:
```js
import Vue from 'vue'
import VueDeprecate from 'vue-deprecate';
Vue.use(VueDeprecate);
```
Then add the file path inside the `plugins` key of `nuxt.config.js`:
```js
export default {
plugins: ['@/plugins/vue-deprecate.js']
}
```
## Usage
Deprecate component:
```js
{
name: 'ExampleComponent',
deprecated: true, // this component is deprecated
data: function () {
return {
count: 0
}
},
template: '
this is deprecated component {{ count }}'
}
```
Add custom message:
```js
{
name: 'ExampleComponent',
deprecated: 'ExampleComponent is deprecated. Use another component.', // this component is deprecated
data: function () {
return {
count: 0
}
},
template: '
this is deprecated component {{ count }}'
}
```
Deprecate property:
```js
{
name: 'ExampleComponent',
props: {
title: String,
header: {
type: String,
deprecated: true, // this property is deprecated
},
},
data: function () {
return {
count: 0
}
},
template: '
this is component {{ count }}'
};
```
### Usage with property decorators (like vue-property-decorator/nuxt-property-decorator)
```js
import { Vue, Component } from 'nuxt-property-decorator'
@Component({
deprecated: true,
})
export default class Test extends Vue {
}
```
## Features
You can:
- mark components as deprecated
- mark component properties as deprecated
A warning with the name of component and/or property is displayed in the console when using deprecated components or properties.
## Links
Article about this project (Polish only): https://fringers.pl/blog/20201103_vue-deprecate