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
});
}
});
}
})
运行结果
网友回复
金煜峰:
that.setData({
content: res.data.replace(/\\n/g, '\n')
});