在此部分代码中 - >预期0-1参数,但得到5。 你能建议我解决一下吗?
version: '3'
services:
web:
image: apache-php7
ports:
- "80:80"
volumes:
- .:/app:cached
tty: true
谢谢!
答案 0 :(得分:1)
添加一个构造函数,将值设置为类变量。
class User {
//declarations
constructor(value, city, regionId, countryId, roleid) {
this.value = value;
this.city = city;
this.regionId = regionId;
this.countryId = countryId;
this.roleId = roleId;
}
//...
}
您正在为构造函数提供5个参数,因此它需要有5个值。
如果您确实想要传递一个对象,那么将一个对象作为参数传递:
let newUser = new User(this.registerForm.value);
//rest of the code