我有一个定制的资源工具(分类帐输入工具),该工具可以修改资源的值,并在相关资源中插入其他行。
“帐户”是主要资源。创建分类帐条目时,都会写入“ AccountTransaction”和“ AccountLog”。通过事件,account.balance值将更新。
在资源工具中成功过帐分类帐分录(使用Nova.request)之后,我希望帐户明细面板中的新余额值已更新,以及AccountTransaction和AccountLog中的新条目可见。
简单的方法是简单地重新加载页面,但是我正在寻找更优雅的解决方案。
是否可以要求这些组件从我的资源工具vue.js组件中刷新自身?
最近,当我提到此block of code时,也遇到了同样的问题
Nova具有vuex存储模块,它们在其中定义了storeFilters。分配筛选器为空对象,然后再次请求它们“重新加载”资源。对此事还没有做更多的研究,但是如果您正在寻找我想寻找的东西,应该就是这样。
async reloadResources() {
this.resourceName = this.$router.currentRoute.params.resourceName || this.$router.currentRoute.name;
if (this.resourceName) {
let filters_backup = _.cloneDeep(this.$store.getters[`${this.resourceName}/filters`]);
let filters_to_change = _.cloneDeep(filters_backup);
filters_to_change.push({});
await this.$store.commit(`${this.resourceName}/storeFilters`, filters_to_change);
await this.$store.commit(`${this.resourceName}/storeFilters`, filters_backup);
}
},