// pages/main/main.js const app = getApp() const api = require("../../utils/request.js"); Page({ /** * 页面的初始数据 */ data: { Hei:0, background: [], indicatorDots: true, vertical: false, autoplay: true, interval: 7000, duration: 1500, nowWork:null }, imgH: function (e) { let winWid = wx.getSystemInfoSync().windowWidth; console.log(e) //获取当前屏幕的宽度 let imgh = e.detail.height;                //图片高度 let imgw = e.detail.width; let swiperH = winWid * imgh / imgw + "px"; this.setData({ Hei: swiperH        //设置高度 }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this api.request('/examtest/banner/', 'GET').then(res => { let images = [] for(var i=0;i