就是下面的
success: res => {
console.log(res);
this.text=res.data.content;}
中的
this.text这里写什么?
我试过
this.nodes.children.text=res.data.content;
this.div.children.text=res.data.content;
this.div.text=res.data.content;
this.text
this.div
都不行
完整的代码如下:
模板中的
<rich-text :nodes="nodes"></rich-text>
数据中的:
data() {
return {
nodes: [{
name: 'div',
attrs: {
class: 'div_class',
style: 'line-height: 60px; color: red; text-align:center;'
},
children: [{
type: 'text',
text: ''
}]
}],
}
},
onLoad: function(e){
console.log(e);
uni.request({
url: *****,
method:'GET',
success: res => {
console.log(res);
this.title=res.data.title;
this.text=res.data.content;
}
0 个回复