Html 我想对通过数据库获取的三个字段求和
第页Html 我想对通过数据库获取的三个字段求和,html,css,ionic-framework,angular7,ionic4,Html,Css,Ionic Framework,Angular7,Ionic4,第页 结果显示3001201335 我想添加这些字段的值,但结果不正确。请告诉我哪里出了问题,并感谢您的帮助使用Number()转换为Number,然后使用+ 或者您可以使用+转换为类似+this.price的数字 price = 300,residential_package = 120, accompany = 1335; this.delegates_total = this.price + this.residential_package + this.accompany; 使
结果显示3001201335
我想添加这些字段的值,但结果不正确。请告诉我哪里出了问题,并感谢您的帮助使用Number()
转换为Number,然后使用+
或者您可以使用+
转换为类似+this.price的数字
price = 300,residential_package = 120, accompany = 1335;
this.delegates_total = this.price + this.residential_package + this.accompany;
使用Number()
转换为数字,然后使用+
或者您可以使用+
转换为类似+this.price的数字
price = 300,residential_package = 120, accompany = 1335;
this.delegates_total = this.price + this.residential_package + this.accompany;
在本例中,您将连接3个字符串
用类型声明字段
price = 300,residential_package = 120, accompany = 1335;
this.delegates_total = Number(this.price) + Number(this.residential_package) + Number(this.accompany);
在本例中,您将连接3个字符串
用类型声明字段
price = 300,residential_package = 120, accompany = 1335;
this.delegates_total = Number(this.price) + Number(this.residential_package) + Number(this.accompany);