34 lines
673 B
JavaScript
34 lines
673 B
JavaScript
const { getArticleById } = require('../../utils/knowledgeData');
|
|
|
|
Page({
|
|
data: {
|
|
article: null
|
|
},
|
|
|
|
onLoad(options) {
|
|
const id = options.id;
|
|
const article = getArticleById(id);
|
|
|
|
if (article) {
|
|
this.setData({
|
|
article: article
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: '文章不存在',
|
|
icon: 'none'
|
|
});
|
|
setTimeout(() => {
|
|
wx.navigateBack();
|
|
}, 1500);
|
|
}
|
|
},
|
|
|
|
// 去占卜
|
|
goToDivination() {
|
|
wx.navigateTo({
|
|
url: '/pages/index/index'
|
|
});
|
|
}
|
|
});
|