import { useStore } from "vuex"
import { getCurrentInstance, computed } from "vue"
setup(){
const store = useStore() // 獲取store 實例
const { ctx } = getCurrentInstance() // 獲取當前組件實例
console.log(ctx.$router.currentRoute.value)
const count = computed( () => store.state.count)
return {count} // 組件中 count 會隨着其他的地方的 count 變化而自動相應變化
}
