huaanglimeng/pages/knowledge/index.js

29 lines
533 B
JavaScript
Raw Permalink Normal View History

const { getCategories } = require('../../utils/knowledgeData');
Page({
data: {
categories: []
},
onLoad() {
this.setData({
categories: getCategories()
});
},
// 返回上一页
handleBack() {
wx.navigateBack({
delta: 1
});
},
// 点击分类卡片
goToList(e) {
const category = e.currentTarget.dataset.category;
wx.navigateTo({
url: `/pages/knowledge/list?category=${category}`
});
}
});