vue-mutable
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "vue-mutable", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Proxies your props into mutable local state.", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-mutable.js", |
@@ -14,11 +14,20 @@ # Vue Mutable | ||
```js | ||
// Installs a global mixin | ||
import { VueMutable } from 'vue-mutable'; | ||
Vue.use(VueMutable); | ||
// Or, use the mixin directly in your component | ||
import { mutableProps } from 'vue-mutable'; | ||
export default { | ||
mixins: [mutableProps] | ||
... | ||
} | ||
``` | ||
## Before | ||
# Why | ||
If you need to modify a prop in a components local state, you need to do a few things: | ||
1. Define the data property | ||
1. Define a data property | ||
2. Set the data property value to the prop value in a lifecycle hook | ||
@@ -50,4 +59,2 @@ 3. Set a watcher for the prop so that if the parent updates the value, the internal value is synced | ||
## After | ||
Vue Mutable simplifies the process for you. Flag any prop as `mutable` and it will be accessible internally as a data property. | ||
@@ -54,0 +61,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9015
12
72