vue.js - 在 Vue 3 中,VUEX 4 突变无法访问 this._vm。如何解决?
问题描述
有任何想法吗?此突变在以前的版本中有效:
{...}
conection(state, ok = true) {
var on = 'You are online',
off = 'You are offline',
status = state.sis.conected
if (ok.code == 'auth/network-request-failed') ok = false
if (status && !ok) this._vm.$alert.error(off)
if (!status && ok) this._vm.$alert.log(on)
state.sis.conected = ok ? true : false
},
{...}
但是现在我收到了这个错误:未捕获的类型错误:无法读取未定义的属性“$alert”
解决方案
推荐阅读
- javascript - Javascript中的冒泡排序算法
- python - 给定索引数组(i1,i2,...),获取 numpy 嵌套数组中的第 i 个元素
- python - 在没有互联网访问的情况下安装 python 模块
- sql - SQL 计数未确认的警报
- reactjs - React 如何在 Gatsby 上工作(静态生成?)
- linux - 需要一个脚本来使 vpn 在 bash 中持久化
- matlab - matlab:如何修复必须返回向量的均值/众数/中值的函数
- css - 在元素中使用定义的高度 (vh) 时,Boostrap 网格、溢出滚动和响应式布局的问题
- r - R结合数据框/删除行与条件
- apache - htaccess 301 重定向与一个链接的异常