vue.js - 记录 rootState 和组件的挂载钩子中发生的所有突变?
问题描述
我有一个消息组件,只要我的应用程序出现问题,它就会显示一个 errorMessage。我想将完整的 vueX 状态 obj 以及发生这种情况时发生的所有突变记录到我的后端,想知道是否可以在错误组件的挂载钩子中完成。
export default {
name: 'Error',
components: { PageHeader },
mounted() {
debugger
console.log('rootState and all prior vueX mutations' ....????);
},
methods: {
}
解决方案
- 获取根状态:
this.$store.state
- 获取 Vuex 变异列表数组:
this.$store._mutations
export default {
name: 'Error',
components: { PageHeader },
mounted() {
console.log('rootState: ', this.$store.state);
console.log('Vuex mutations: ', this.$store._mutations);
},
methods: {
}
推荐阅读
- ruby-on-rails - 以简单形式迭代对象时处理输入
- angular - 无法创建自定义角度元素
- android - 在 firebase 实时数据库中添加“.indexOn”规则的正确方法是什么?
- c# - 如何在 ASP .NET Core Razor 页面中读取连接字符串
- jpa - 为什么 JPA - 外键不会出错“错误 1452:1452:无法添加或更新子行:外键约束失败”
- java - 避免 BigDecimal 添加 0 java
- codeigniter - 如何修复 Codeigniter 4 中的表单验证错误
- mongodb - MongoDB 几个坐标不适用于 geonear
- android - com.beardedhen.androidbootstrap.BootstrapEditText 类型定义了多次
- python - 用 SQLalchemy 映射 MSSQL 中预先存在的表的方法是什么