这是初始值:
data(){
tap:[
{taps:''}
]
};
tapCode:''
要将tap中的数据转化为字符串储存在tapCode中:
this.tapCode = "";//要确保字符串为空
for ( let i = 0; i < this.tap.length; i++ ) {
if ( i < this.tap.length - 1 ) {
this.base.tapCode += this.tap[i].taps + ",";
} else {
this.base.tapCode += this.tap[i].taps
}
}
//结果:tap:[
{taps:'124143'},
{taps:'124143'},
{taps:'124143'}
]
tapCode:"124143,124143,124143"
标签:taps,tap,tapCode,124143,转化,length,数组,字符串
From: https://www.cnblogs.com/WClown/p/16898701.html