vue中js空对象中以key:value插入数据
this.advertScope=''this.advertMediaType=''this.auditStatus=''var obj={"reqTime":'this.reqTime',"reqDate":"this.reqDate","tenantId":"0",//租户id"merchantNo": "th...
·
源码Demo:
this.advertScope=''
this.advertMediaType=''
this.auditStatus=''
var obj={
"reqTime":'this.reqTime',
"reqDate":"this.reqDate",
"tenantId":"0",//租户id
"merchantNo": "this.username",
"advertScope":this.advertScope,//投放范围
"advertMediaType":this.advertMediaType,//类型
"auditStatus":this.auditStatus//状态
}
关注我的微信公众号【前端基础教程从0开始】,加我微信,可以免费为您解答问题。回复“1”,拉你进程序员技术讨论群。回复“小程序”,领取300个优秀的小程序开源代码+一套入门教程。回复“领取资源”,领取300G前端,Java,微信小程序,Python等资源,让我们一起学前端。
var newObjs={}
var strs=''
for(var item in obj){
if(obj[item]!=''){
str = "newObjs."+item+"='"+obj[item]+"'";
eval(str);
}
}
console.log(newObjs)
更多推荐
已为社区贡献13条内容
所有评论(0)