我想知道是否可以在像这样的函数中重新加载asyncData
Page
<template>
<component-child :products="products" @asyncData="asyncData" />
</template>async asyncData({ $axios, store }) {
const customerId = store.getters['user/auth/customerId'];
if (!customerId) {
return;
}
const products = await customerApi.getProducts(
{ $axios },
customerId,
);
return {
products: products
};
},component-child
methods: {
infiniteHandler() {
this.$emit('asyncData);
}
}有可能吗?不然怎么做呢?
发布于 2021-08-28 22:09:39
您可以尝试this.$nuxt.refresh()刷新fetch()或asyncData()挂钩。
如文档中所解释的:https://nuxtjs.org/docs/2.x/concepts/context-helpers#refreshing-page-data
https://stackoverflow.com/questions/68966175
复制相似问题