// pages/detail/detail.js
// 29014
const $api = require('../../utils/api.js').API;
Page({
/**
* 页面的初始数据
*/
data: {
name:'',
articleid:'',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.type == '百科'){
$api.getBaikeDetail({category_id:options.id}).then(res=>{
let data = res.data.data
data.content = data.content.replaceAll(')/gi, "") //替换了注释的内容这能替掉大部分
.replace(/]*>(.|\n)*<\/xml>/gi, "") //替换了xml标签word粘贴带出一堆标签包含在xml里
.replace(/undefined/gi, "") //里面莫名有个undefined
this.setData({
info:data,
name:res.data.data.name,
articleid:options.id,
})
this.data.info.content = this.data.info.content.replace('{
let data = res.data.data
data.content = data.content.replaceAll('