<template>
    <div>
        <h2 style="color: red">{{ store.state.username }}</h2>
        <button @click="changeName">change username</button>
        <TestA/>
        sss
        <TestB v-if="store.state.username == '456456'" />
    </div>
</template>
<script setup>
import TestA from "../components/TestA.vue";
import TestB from "../components/TestB.vue";
import {useStore} from 'vuex'
const store = useStore();
function changeName() {
    store.commit('changeUsername','456789')
}
</script>