// pages/scout/share/share.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { imgUrl: app.globalData.urlStatic, //图片路径 posterList: ['poster1', 'poster2', 'poster3'], posterIndex: 1, }, /** * 切换海报 */ changePoster(event) { this.setData({ posterIndex: event.detail.current }) }, prevPoster() { if (this.data.posterIndex - 1 >= 0) { this.setData({ posterIndex: this.data.posterIndex - 1 }) } }, nextPoster() { if (this.data.posterIndex + 1 < this.data.posterList.length) { this.setData({ posterIndex: this.data.posterIndex + 1 }) } }, /** * 查看大图 */ bigPoster() { console.log('查看大图') }, /** * 长按保存 */ savePoster() { console.log('长按保存') }, /** * 分享好友 */ sharePoster() { console.log('分享海报') wx.showShareMenu({ withShareTicket: true }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { return app.sharePack(); } })