// pages/repeat/repeat.js Page({ /** * 页面的初始数据 */ data: { nvabarData: { showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示 title: '设置重复', //导航栏 中间的标题 }, items: [ {value: '0', name: '周日'}, {value: '1', name: '周一'}, {value: '2', name: '周二'}, {value: '3', name: '周三'}, {value: '4', name: '周四'}, {value: '5', name: '周五'}, {value: '6', name: '周六'} ], week_actives: [0,0,0,0,0,0,0], }, action(e) { this.data.week_actives[e.currentTarget.dataset.index] = this.data.week_actives[e.currentTarget.dataset.index] === 0 ? 1 : 0; this.setData({ week_actives: this.data.week_actives }); getCurrentPages().map((v)=> { if(v.route === "pages/deviceWake/deviceWake") { v.setRepeat(this.data.week_actives); }; }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { const week_actives = []; options.week_actives.split(",").map((v)=>{ week_actives.push(parseInt(v, 10)); }); this.setData({ week_actives: week_actives }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })