<template> <block> <rich-text :nodes="content.content"></rich-text> </block> </template> <script> // pages/tabbar/index/index.js var app = getApp(); export default { data() { return { content:"" }; }, onLoad: function(options) { this.id = options.id; this.getinfo() }, onShow() { }, onPullDownRefresh: function() {}, onReachBottom: function() { }, onShareAppMessage: function() {}, methods: { async getinfo() { var that = this; let res = await this.$api.request('/article/detail', 'GET', { id: this.id, }); res.content = res.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'); this.content = res } } }; </script> <style> page { background: #F5F5F5; padding: 20rpx; box-sizing: border-box; } </style>