javascript - 对象值到数组,然后替换,而不是函数?
问题描述
所以我正在使用 Vue.js,这不是我知道的问题,这只是我做错了,我这样做是有原因的,但我一直收到一个错误,比如它不是数组.
代码:
methods: {
async register() {
this.errors = '';
this.success = '';
await RegisterService.insertUser(this.email, this.username, this.password, this.passwordTwo)
.then(data => {
if (data.data) {
let v = Object.values(data.data);
console.log(v);
v = v.replace(/["[]]/g, '');
this.errors = v;
} else {
this.success = `Registration Successful!`;
}
});
}
}
所以我得到的v.replace
不是一个函数,我确信这有一个简单的原因,我只是想弄清楚。
解决方案
推荐阅读
- javascript - vuex 中 { dispatch, commit } 的类型是什么?
- oracle-apex - Apex 应用程序文本项字段的电子邮件验证
- ruby - 无法在本地运行 rails 应用程序
- php - 是否可以询问 PDO 以确定查询当前是否处于活动状态?
- excel - Excel 条件格式行背景,使用现有手动格式跳过单元格
- ios - 可选原始类型的字符串初始值设定项:Int? 双倍的?漂浮?ETC
- .net - 为什么我应该通过我自己的类调用 File.Delete()?
- html - 打印为 PDF 时,表格内的表格都重复
- amazon-web-services - Lex 自定义槽中的动态值
- java - Java 字符串构造函数