functionstoreToRefs(store) { // See https://github.com/vuejs/pinia/issues/852 // It's easier to just use toRefs() even if it includes more stuff if (isVue2) { // @ts-expect-error: toRefs include methods and others returntoRefs(store); } else { // store是个proxy对象,通过toRaw解出原始对象,防止重复引用 store = toRaw(store); const refs = {}; // 遍历每个键值,包裹为响应式 for (const key in store) { const value = store[key]; if (isRef(value) || isReactive(value)) { // @ts-expect-error: the key is state or getter refs[key] = // --- toRef(store, key); } } return refs; } }