You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
466 B

<script setup>
import { useStore } from "vuex";
const store = useStore();
const handlePlus = () => {
store.commit("increment");
};
const handleSub = () => {
store.commit("subtraction");
};
</script>
<template>
<h3>{{ store.state.title }}</h3>
<button @click="handleSub">-</button>
<span>{{ store.state.count }}</span>
<button @click="handlePlus">+</button>
</template>
<style scoped>
span {
font-size: 20px;
padding: 0 10px;
font-weight: 600;
}
</style>