Browse Source

vuex命空间

test
liwei 3 years ago
parent
commit
4f43eb5834
3 changed files with 15 additions and 5 deletions
  1. +2
    -2
      src/store/plant/technologyState.js
  2. +2
    -2
      src/views/plant/technology/index.vue
  3. +11
    -1
      src/views/plant/technology/product/procedureComponent/index.vue

+ 2
- 2
src/store/plant/technologyState.js View File

@ -9,8 +9,8 @@ export default {
}
},
actions: {
incrementData(context, componentData) {
context.commit('increment', componentData);
incrementData({commit}, payload) {
commit('increment', payload);
}
}
};

+ 2
- 2
src/views/plant/technology/index.vue View File

@ -7,7 +7,7 @@
</template>
<script>
import Product from './product';
import {mapState, mapMutations, mapGetters, mapActions} from 'vuex';
import {mapState} from 'vuex';
export default {
components:{
Product
@ -21,7 +21,7 @@ export default {
])
},
mounted(){
console.log(this);
console.log(this.count);
}
};
</script>


+ 11
- 1
src/views/plant/technology/product/procedureComponent/index.vue View File

@ -77,6 +77,7 @@
</div>
</template>
<script>
import {mapState, mapActions} from 'vuex';
export default {
data(){
return{
@ -113,10 +114,19 @@ export default {
currentRow: null
}
},
computed: {
...mapState('technologyState',['count']),
},
watch: {
count(currVal) {
console.log(currVal);
}
},
methods:{
...mapActions('technologyState',['incrementData']),
handleCurrentChange(val){
this.currentRow = val;
console.log(val);
this.incrementData(this.count++);
}
}
}


Loading…
Cancel
Save