26 lines
523 B
JavaScript
26 lines
523 B
JavaScript
// components/ComponentA.js
|
|
|
|
const ComponentA = {
|
|
template: `
|
|
<div>
|
|
<h2>Component A</h2>
|
|
<p>Count: {{ count }}</p>
|
|
<v-btn @click="increment">Increment</v-btn>
|
|
<v-btn @click="decrement">Decrement</v-btn>
|
|
</div>
|
|
`,
|
|
computed: {
|
|
count() {
|
|
return this.$store.state.count;
|
|
}
|
|
},
|
|
methods: {
|
|
increment() {
|
|
this.$store.dispatch('increment');
|
|
},
|
|
decrement() {
|
|
this.$store.dispatch('decrement');
|
|
}
|
|
}
|
|
};
|
|
|