You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
// pages/fenlei/fenlei.js
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
cateItems: [
|
|
|
|
|
{
|
|
|
|
|
cate_id: 1,
|
|
|
|
|
cate_name: "小说",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
children:
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
child_id: 1,
|
|
|
|
|
name: '福尔摩斯',
|
|
|
|
|
image: "/pages/index/image/xs1.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 2,
|
|
|
|
|
name: '莫泊桑',
|
|
|
|
|
image: "/pages/index/image/xs2.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 3,
|
|
|
|
|
name: '盗墓笔记',
|
|
|
|
|
image: "/pages/index/image/xs3.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 4,
|
|
|
|
|
name: '明朝那些事',
|
|
|
|
|
image: "/pages/index/image/xs4.jpg"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cate_id: 2,
|
|
|
|
|
cate_name: "科学期刊",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
children:
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
child_id: 1,
|
|
|
|
|
name: '世界百科',
|
|
|
|
|
image: "/pages/index/image/kxqk1.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 2,
|
|
|
|
|
name: '动物百科',
|
|
|
|
|
image: "/pages/index/image/kxqk2.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 3,
|
|
|
|
|
name: '趣味科学',
|
|
|
|
|
image: "/pages/index/image/kxqk3.jpg"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cate_id: 3,
|
|
|
|
|
cate_name: "儿童书籍",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
children:
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
child_id: 1,
|
|
|
|
|
name: '父与子全集',
|
|
|
|
|
image: "/pages/index/image/etsj1.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 2,
|
|
|
|
|
name: '丁丁历险记',
|
|
|
|
|
image: "/pages/index/image/etsj2.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 3,
|
|
|
|
|
name: '美丽星空',
|
|
|
|
|
image: "/pages/index/image/etsj3.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 4,
|
|
|
|
|
name: '小虎神探队',
|
|
|
|
|
image: "/pages/index/image/etsj4.jpg"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
cate_id: 4,
|
|
|
|
|
cate_name: "计算机",
|
|
|
|
|
ishaveChild: true,
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
child_id: 1,
|
|
|
|
|
name: 'Java Web',
|
|
|
|
|
image: "/pages/index/image/java.jpg"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
child_id: 2,
|
|
|
|
|
name: '计算机网络',
|
|
|
|
|
image:"/pages/index/image/jsswl.jpg"
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
curNav: 1,
|
|
|
|
|
curIndex: 0
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//事件处理函数
|
|
|
|
|
switchRightTab: function (e) {
|
|
|
|
|
// 获取item项的id,和数组的下标值
|
|
|
|
|
let id = e.target.dataset.id,
|
|
|
|
|
index = parseInt(e.target.dataset.index);
|
|
|
|
|
// 把点击到的某一项,设为当前index
|
|
|
|
|
this.setData({
|
|
|
|
|
curNav: id,
|
|
|
|
|
curIndex: index
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|