结果示例
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/eee9441e4dc8400fafd9c117199e9daa.png)
代码
const content = ["123","G240510001","1000S"]
uni.showModal({
title: '原料扫描信息如下',
content:
'物料编码:'+ `\t` + this.padRight(content[0],textLenth)+ `\t` + `\n` +
'批'+'\u3000\u3000'+'号:'+ `\t` + this.padRight(content[1],textLenth) + `\t` + `\n` +
'重'+'\u3000\u3000'+'量:'+ `\t` + this.padRight(content[2],textLenth) + `\t` + `\n`,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
padRight(str, length) {
return str + ' \u00A0'.repeat(length - str.length)
},