vue拼接换行符
vue拼接换行符//处理换行var str = 'abc123'var index = parseInt(str / 2) //从中间开始换行var charArray = str.split('');//将abc123拆分成数组 ["a","b","c","1","2","3"]charArray[index] = '\n' + charArray[index]var newStr = char
·
vue拼接换行符
//处理换行
var str = 'abc123'
var index = parseInt(str / 2) //从中间开始换行
var charArray = str.split('');//将abc123拆分成数组 ["a","b","c","1","2","3"]
charArray[index] = '\n' + charArray[index]
var newStr = charArray.join('')
//最终页面显示就是
abc
123
方法2:
//处理换行
var str = 'abc123'
var index = parseInt(str / 2) //从中间开始换行
var charArray = str.split('');//将abc123拆分成数组 ["a","b","c","1","2","3"]
charArray[index] = '<br/>' + charArray[index]
var newStr = charArray.join('')
//最终页面显示就是
abc
123
更多推荐
已为社区贡献2条内容
所有评论(0)