【发布时间】:2021-09-17 08:23:55
【问题描述】:
我有一个动态 id 的路由,例如 post/:postId 和包含很多方法和函数的可组合函数。
当我从路线 post/1 转到 post/2 时,可组合没有更新,我得到了 id 1 的信息
如何强制重新初始化可组合函数?
<script>
import postFunctions from '~/composable/postHelpers';
import { useContext } from '@nuxtjs/composition-api';
setup() {
const { store, params } = useContext();
const { postComments, updatePostText } = postFunctions(params.value.postId)
}
【问题讨论】: