<import src="/common/wxParse/wxParse.wxml" /> wxml文件 这里引入 <view class="author_img"> <image class="" src="{{ArticleDetail.article_picture}}" lazy-load="false" binderror="" bindload=""></image> </view> <view class="DetailBox"> <view class="DetailTile">{{ArticleDetail.article_title}}</view> <view class="Detail_author"> <text class="author_time">{{ArticleDetail.time}}</text> <!-- <text class="author_name">作者: 翟少辉</text> <text class="author_source">来源: 21世纪经济报道</text> --> </view> <!-- <view class="halving_line"></view> --> <view class="Detail_text" hover-class="none" hover-stop-propagation="false"> <!-- {{ArticleDetail.article_content}} --> <template is="wxParse" data="{{wxParseData:content.nodes}}" />
</view>
var WxParse = require('../../../../common/wxParse/wxParse.js'); js文件
// 获取文章详情
get_articleInfo: function () {
const that = this;
var postsData = {
id: that.data.id
}
let dataInfo = requestSign.requestSign(postsData)
header.sign = dataInfo
wx.request({
url: api.get_articleInfo,
data: postsData,
header: header,
method: 'POST',
dataType: 'json',
responseType: 'text',
success: ({
data
}) => {
console.log(data, '文章详情')
if (data.code == 1) {
data.data.time = time.js_date_time_second(data.data.create_time)
let result = data.data.article_content ==》接口内容
WxParse.wxParse('content', 'html', result, that, 5);
that.setData({
ArticleDetail: data.data,
goods_list: data.goods_list,
tagsNumber: data.data.tags_num,
tags: data.data.tags
})
} else {
wx.showToast({
title: data.message
})
}
}
});
},