79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
// pages/list/list.js
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
title: '加载中...', // 状态
|
||
list: [{id:'01',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'}], // 数据列表
|
||
type: '', // 数据类型
|
||
loading: true, // 显示等待框
|
||
page: 0, // page:当前页--
|
||
tabList: [{
|
||
title: '现场直播',
|
||
num: 0
|
||
}, {
|
||
title: '特殊事件',
|
||
num: 1
|
||
}],
|
||
movie: {title:'日本7.2级地震',images:'111',year:'2022年7月7日',average:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',directors:'111',name:'111',casts:'111',directors:'111',summary:'1111'},
|
||
currentIndex:0
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
// 切换tab
|
||
change: function (event) {
|
||
console.log('切换时会调用', event);
|
||
var a = event.currentTarget.dataset.pageid
|
||
this.setData({
|
||
page: a,
|
||
})
|
||
},
|
||
//点击tab时触发
|
||
titleClick: function (e) {
|
||
this.setData({
|
||
//拿到当前索引并动态改变
|
||
currentIndex: e.currentTarget.dataset.idx
|
||
})
|
||
},
|
||
// changeNext:function () {
|
||
// setTimeout(() => {
|
||
// wx.redirectTo({
|
||
// url:'/pages/item/item'
|
||
// })
|
||
// }, 2000);
|
||
// },
|
||
onLoad: function (options) { // options 为 board页传来的参数
|
||
const _this = this;
|
||
// 拼接请求url
|
||
// const url = 'https://api.douban.com/v2/movie/' + options.type;
|
||
// const url = '' + options.type;
|
||
// // 请求数据
|
||
// wx.request({
|
||
// url: url,
|
||
// data: {},
|
||
// header: {
|
||
// 'content-type': 'json' // 默认值
|
||
// },
|
||
// success: function(res) {
|
||
// console.log(res.data);
|
||
// // 赋值
|
||
// _this.setData({
|
||
// title: res.data.title,
|
||
// list: res.data.subjects,
|
||
// type: options.type,
|
||
// loading: false // 关闭等待框
|
||
// })
|
||
// }
|
||
// })
|
||
_this.setData({
|
||
title: '日本7.2级地震',
|
||
list: [{id:'001',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'}],
|
||
type: '1111',
|
||
loading: false // 关闭等待框
|
||
})
|
||
}
|
||
}) |