bridgeSpace/pages/list/list.js

70 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// pages/list/list.js
Page({
/**
* 页面的初始数据
*/
data: {
title: '加载中...', // 状态
list: [{id:'01',title:'日本7.2级地震',content:'170000日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'}], // 数据列表
type: '', // 数据类型
loading: true, // 显示等待框
page: 0, // page当前页--
tabList: [{
title: '预警信息',
num: 0
}, {
title: '特殊事件',
num: 0
}],
},
/**
* 生命周期函数--监听页面加载
*/
// 切换tab
change: function (event) {
console.log('切换时会调用', event);
var a = event.currentTarget.dataset.pageid
this.setData({
page: a,
})
},
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日'},{id:'002',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'},{id:'003',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'},{id:'003',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'},{id:'003',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'},{id:'003',title:'日本7.2级地震',content:'17:00:00日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',year:'2022年7月7日'}],
type: '1111',
loading: false // 关闭等待框
})
}
})