zoukankan      html  css  js  c++  java
  • 小程序 swiper banner 图片 居中

    var imgUrlApp = getApp().globalData.imgUrlApp;
    Page({
      /**
       * 页面的初始数据
       */
      data: {
        indicatorDots: true,
        vertical: false,
        autoplay: false,
        circular: false,
        interval: 2000,
        duration: 500,
        previousMargin: 0,
        nextMargin: 0,
        imgUrlApp: imgUrlApp,
        swiperimgUrls: ['http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
          'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg'
        ],
        userinfo: {},
        companyinfo: {}
      },
    
      /**
       * 生命周期函数--监听页面加载
       */
      onLoad: function(options) {
        var that = this;
        console.log(
            wx.getStorageSync("username")),
          wx.request({
            url: getApp().globalData.apiUrlApp + 'acc/get_userinfo/',
            header: {
              "Content-Type": "application/x-www-form-urlencoded",
              'cookie': wx.getStorageSync("username"), //读取cookie,
              'cookie': wx.getStorageSync("uid"), //读取cookie,
              'cookie': wx.getStorageSync("gid") //读取cookie,
    
            },
            method: "GET",
            data: {
              username: wx.getStorageSync("username")
            },
            success: function(res) {
              console.log(res)
              if (res.data.status == 1) {
                wx.showToast({
                    // title: res.data.info,
                    title: "帐号详情",
                    icon: 'success',
                    duration: 1500
                  }),
                  that.setData({
                    userinfo: res.data.data
                  }),
                  wx.request({
                    url: getApp().globalData.apiUrlApp + 'common/get_orginfo/',
                    header: {
                      "Content-Type": "application/x-www-form-urlencoded",
                      'cookie': wx.getStorageSync("username"), //读取cookie,
                      'cookie': wx.getStorageSync("uid"), //读取cookie,
                      'cookie': wx.getStorageSync("gid") //读取cookie,
    
                    },
                    method: "GET",
                    data: {
                      uid: wx.getStorageSync("uid")
                    },
                    success: function(res) {
                      console.log(res)
                      if (res.data.status == 1) {
                        wx.showToast({
                            // title: res.data.info,
                            title: "帐号详情",
                            icon: 'success',
                            duration: 1500
                          }),
                          that.setData({
                            companyinfo: res.data.data
                          })
                      } else if (res.data.status == 0) {
                        wx.showToast({
                          title: "无数据返回",
                          icon: 'success',
                          duration: 1500
                        })
                      } else if (res.data.status == -1) {
                        wx.showToast({
                          title: "请求异常,请检查重试",
                          icon: 'loading',
                          duration: 2000
                        })
                      }
                    }
                  })
              } else if (res.data.status == 0) {
                wx.showToast({
                  title: "无数据返回",
                  icon: 'success',
                  duration: 1500
                })
              } else if (res.data.status == -1) {
                wx.showToast({
                  title: "请求异常,请检查重试",
                  icon: 'loading',
                  duration: 2000
                })
              }
            }
          })
      },
    
      /**
       * 生命周期函数--监听页面初次渲染完成
       */
      onReady: function() {
    
      },
    
      /**
       * 生命周期函数--监听页面显示
       */
      onShow: function() {
    
      },
    
      /**
       * 生命周期函数--监听页面隐藏
       */
      onHide: function() {
    
      },
    
      /**
       * 生命周期函数--监听页面卸载
       */
      onUnload: function() {
    
      },
    
      /**
       * 页面相关事件处理函数--监听用户下拉动作
       */
      onPullDownRefresh: function() {
    
      },
    
      /**
       * 页面上拉触底事件的处理函数
       */
      onReachBottom: function() {
    
      },
    
      /**
       * 用户点击右上角分享
       */
      onShareAppMessage: function() {
    
      },
    
      onShow: function() {
        // 页面显示  
      },
      onHide: function() {
        // 页面隐藏  
      },
      onUnload: function() {
        // 页面关闭  
      },
    })
    @import "../../style/weui.wxss";
    

      

    <view class="mainpage">
      <view class="banner">
        <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" circular="{{circular}}" vertical="{{vertical}}" interval="{{interval}}" duration="{{duration}}" previous-margin="{{previousMargin}}px" next-margin="{{nextMargin}}px">
          <block wx:for="{{swiperimgUrls}}" wx:key="*this">
            <swiper-item>
              <image src="{{item}}" class="slide-image" style="100%" />
            </swiper-item>
          </block>
        </swiper>
    
      </view>
    

      

  • 相关阅读:
    三:redis的数据类型
    二:redis配置
    一:redis安装(Windows)
    Mysql数据库的调优
    JAVA中的设计模式四(装饰模式)
    tomcat启动正常,但是访问项目时,404. Eclipse没有正确部署工程项目
    在eclipse中安装jadclipse的反编译插件
    部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener【转】
    自动生成编号,id,序号,采用不同策略生成
    POI实现Excel导入导出
  • 原文地址:https://www.cnblogs.com/rsapaper/p/9255794.html
Copyright © 2011-2022 走看看