str = str.replace(/ /g, '\xa0'); 我修改了这行代码 还是解析不了空格
增加space="nbsp"就行,空白不用替换
Page({ onLoad(){ var html='a b'; this.setData({html}); } }) <rich-text space="nbsp" nodes="{{html}}"></rich-text>