vue-setstate
v0.0.4
Published
Optimizing Vue big data processing
Downloads
12
Maintainers
Readme
vue-setState
Using React style setState method in Vue, Apply to optimize rendering speed of big data
Install
$ npm i vue-setstate -S
Usage
import Vue from 'vue'
import setState from 'vue-setstate'
Vue.use(setState)
Then in your component:
<script>
export default {
state: {
// your data here
name: 'tom'
},
methods: {
changeMyName () {
this.setState({ name: 'mary' })
},
changeMyNameWithFunctionalParam () {
this.setState(({ name }) => ({
name: `Hi ${name}`
}))
}
}
}
</script>
Warning:
state
is not reactive!, you must usesetState
method if you want to change the view.
License
Copyright (c) 2017-present, Army-U