## 基础版
### 给store赋值
```
this.$store.dispatch('search',this.value)
```
### 接收值
```
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
searchvalue:''
},
mutations: {
search(state,searchvalue){
//state表示vuex里的state ,letter是actions传递过来的参数
state.searchvalue = searchvalue
}
},
actions: {
search(ctx, searchvalue) {
ctx.commit("search", searchvalue)
}
},
modules: {
}
})
```
### 使用值
```
<h1>{{this.$store.state.searchvalue}}</h1>
```