微信小程序如何设置轮播图的尺寸为950*450

微信小程序如何设置轮播图的尺寸为950*450,第1张

微信小程序设置轮播图的尺寸为950*450的 *** 作方法如下:

1、打开微信开发者工具。

2、找到wxml文件

3、新建一个swiper标签。

4、设置swiper和autoplay的属性。

5、点击autoplay设置为自动轮播。

6、使用block标签,放置要轮播的图片,展示大小设置为950*450即可。

新接了一个做微信小程序的活,编码方式跟vue很相似,样式编写比普通css样式轻松的多,现要实现一个轮播图的效果。

请教了我的同学,她说小程序有两种方法能实现这个效果:

微信小程序—swiper组件文档

wxml文件:

js文件:

法一实现出来的效果图是酱紫的:

wxml文件:

js文件:

wxss文件:

用法二实现出来的效果图是酱紫的:

1.缓存用户及密码:

wxml内容:

<!--pages/shuoye/shouye.wxml-->

<text>用户名:</text><input class="input-sty" placeholder="请输入您的账户" bindinput="bindKeyInput"/>

<text>密码:</text><input class="input-sty" placeholder="请输入您的密码" bindinput="bindKeyInput2" type="password"/>

<button bindtap="dl" size="mini" type="primary" plain="">登录</button>

js内容

// pages/shuoye/shouye.js

Page({

    /**

     * 页面的初始数据

     */

    data: {

    },

    bindKeyInput:function(e){

        console.log(e)

        let {detail:{value}} = e

        this.setData({

            inputVal:value

        })

        },

    bindKeyInput2:function(a){

        console.log(a)

        let {detail:{value}} = a

        this.setData({

            inputVal1:value

        })

        },

    dl:function(res){

        wx.setStorageSync('username', this.data.inputVal),

        wx.setStorageSync('password', this.data.inputVal1),

        wx.navigateTo({

          url: '/pages/lunbo/lunbo',

        })

    },

    /**

     * 生命周期函数--监听页面加载

     */

    onLoad: function (options) {

    },

    /**

     * 生命周期函数--监听页面初次渲染完成

     */

    onReady: function () {

    },

    /**

     * 生命周期函数--监听页面显示

     */

    onShow: function () {

    },

    /**

     * 生命周期函数--监听页面隐藏

     */

    onHide: function () {

    },

    /**

     * 生命周期函数--监听页面卸载

     */

    onUnload: function () {

    },

    /**

     * 页面相关事件处理函数--监听用户下拉动作

     */

    onPullDownRefresh: function () {

    },

    /**

     * 页面上拉触底事件的处理函数

     */

    onReachBottom: function () {

    },

    /**

     * 用户点击右上角分享

     */

    onShareAppMessage: function () {

    }

})

wxss内容:

/* pages/shuoye/shouye.wxss */

.input-sty{

    border: 1px solid #000

    margin: 5px

    padding: 5px

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7798864.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-10
下一篇 2023-04-10

发表评论

登录后才能评论

评论列表(0条)

保存