12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- id:0,
- info:{},
- content: '',
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let id = options.id;
- this.setData({id:id});
- this.getInfo();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- let info = this.data.info
- return {
- title: info.title,
- path: "/pages/article/detail/detail?id="+info.id,
- imageUrl: info.main_image,
- };
- },
- //详情
- getInfo() {
- let self = this;
- app.get('portal/articles/'+this.data.id,function(res){
- self.setData({info:res});
- self.setData({ content: res.post_content.replace(/\<img/gi, '<img style="max-width:100%;display:block;" ') });
- });
- },
- })
|