\xe2\x9c\x85 Vue 2: \n计算属性在 vuex 存储突变后更新。
\n\xe2\x9d\x8c Vue 3: \nvuex 存储突变后计算属性不会更新。
\n目的:从 Firestore 获取帖子。添加到“postsArray”。进行突变。
\n注意:函数“getNextPosts”是从允许无限滚动的(工作)交叉观察器调用的。
\nconst postsArray: Array<string> = [];\nconst vuexStore = createStore({\n state: {\n posts: []\n },\n actions: {\n // See https://firebase.google.com/docs/firestore/query-data/query-cursors#paginate_a_query\n getFirstPosts({ commit }) {\n const getFirstPosts = async () => {\n const firstPostsQuery = firestore.collection("posts").limit(3);\n\n // Get FIRST posts.\n const firstPosts = await firstPostsQuery.get();\n\n // Add to postsArray.\n for (const doc of firstPosts.docs) {\n …Run Code Online (Sandbox Code Playgroud)