bridgeSpace/miniprogram/pages/items/items.js

71 lines
1.8 KiB
JavaScript
Raw Permalink 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/item/item.js
Page({
/**
* 页面的初始数据
*/
data: {
title: '',
loading: true,
movie: {},
currentIndex: 0,
},
/**
* 生命周期函数--监听页面加载
*/
pagechange: function (e) {
// 通过touch判断改变tab的下标值
// if ("touch" === e.detail.source) {
// let currentPageIndex = this.data.currentIndex;
// currentPageIndex = (currentPageIndex + 1) % 2;
// // 拿到当前索引并动态改变
// this.setData({
// currentIndex: currentPageIndex,
// })
// }
},
//点击tab时触发
titleClick: function (e) {
this.setData({
//拿到当前索引并动态改变
currentIndex: e.currentTarget.dataset.idx
})
},
onLoad: function (options) {
const _this = this;
// 拼接请求url
// const url = 'https://api.douban.com/v2/movie/subject/' + options.id;
// // 请求数据
// wx.request({
// url: url,
// data: {},
// header: {
// 'content-type': 'json' // 默认值
// },
// success:function(res) {
// // 赋值
// _this.setData({
// movie: res.data,
// loading: false // 隐藏等待框
// })
// }
// })
_this.setData({
movie: {title:'日本7.2级地震',images:'111',year:'2022年7月7日',average:'170000日本发生7.2级地震,张家港桥跨中位移超限,其余桥梁无异',directors:'111',name:'111',casts:'111',directors:'111',summary:'1111'},
loading: false // 隐藏等待框
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
// 修改导航栏标题
wx.setNavigationBarTitle({
// title: this.data.title + '<<预警信息<<详情'
title: this.data.title+ '事件回看'
})
}
})