使用text标签时,\n可换行,但是如果内容是从网络中获取的,如何换行呢?
index.wxml
<text>{{content}}</text>
index.js
const app = getApp()
Page({
data: {
content: 'Hello World',
},
onLoad: function(){
var that = this;
wx.request({
url: 'https://test.uaivg.com/test',
success: function(res){
console.log(res);
that.setData({
content: res.data
});
}
});
}
})
运行结果