This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
import { watch } from 'vue'; | |
import { storeToRefs } from 'pinia'; | |
import { useCounterStore } from '@/stores/counter.js'; | |
const store = useCounterStore(); | |
const { count } = storeToRefs(store); | |
console.log('count===>', count); | |
// 这上面的 count 会不会随着 store 里 count 的更新而自动响应? | |
// 答: 经实践,会。而且不论 store 是用 选项方式 定义的还是 组合函数方式 定义的 |