omi-cloud - update detail page

This commit is contained in:
dntzhang 2019-03-21 15:23:34 +08:00
parent 0bcc2c124d
commit f3e99eb07d
2 changed files with 16 additions and 10 deletions

View File

@ -5,6 +5,8 @@ import WxParse from '../../components/wxParse/wxParse'
//获取应用实例
const app = getApp()
const Remarkable = require('remarkable')
const md = new Remarkable()
define('page-about', class extends WeElement {
config = {
@ -15,17 +17,15 @@ define('page-about', class extends WeElement {
backgroundTextStyle: 'light'
}
installed() {
const Remarkable = require('remarkable');
const md = new Remarkable();
const article = md.render(mdStr.data)
console.log(article)
WxParse.wxParse('article', 'html', article, this._weappRef, 5)
app.globalData.db.collection('article').doc('xx').get().then()
install(options) {
app.globalData.db.collection('article').doc(options.id).get().then(res=>{
const article = md.render(res.data.md)
WxParse.wxParse('article', 'html', article, this._weappRef, 5)
})
}
render() {
return (
<view>

View File

@ -39,11 +39,17 @@ define('page-about', class extends WeElement {
})
}
gotoDetail = (evt) => {
wx.navigateTo({
url: '../detail/index?id=' + evt.target.dataset.id
})
}
render() {
return (
<view>
{list.map(item=>(
<view class='item'>
<view class='item' data-id={item._id} bindtap={this.gotoDetail}>
<text>{item.title}</text>
<image src={arrowPng}></image>
</view>