Pinia 提供了 `storeToRefs` 方法将 store 转换为 ref 对象,但是没有提供直接将 store 转换为 reactive 对象的方法。不过你可以通过 `toRefs` 和 `reactive` 函数结合使用来实现这个功能。
首先,使用 `toRefs` 将 store 转换为 ref 对象:
```javascript
import { defineStore } from 'pinia'
const useCounter = defineStore({
id: 'counter',
state: () => ({
count: 0,
}),
})
const counterStore = useCounter()
const counterRef = toRefs(counterStore)
```
然后,使用 `reactive` 函数将 ref 对象转换为 reactive 对象:
```javascript
const counterReactive = reactive(counterRef)
```
这样就可以将 Pinia 的 store 转换为 reactive 对象了。需要注意的是,由于 `toRefs` 返回的是 ref 对象,因此在使用 `reactive` 函数时需要将其解构为普通对象。