首页 > 其他分享 >2.7

2.7

时间:2024-02-07 18:44:06浏览次数:20  
标签:flex res images home 2.7 pages png

今天写了一个实例,下图是完整的效果。

 

<!--pages/home/home.wxml-->
<swiper indicator-dots circular>
    <swiper-item wx:for="{{swiperList}}" wx:key="id">
        <image src="{{item.image}}"></image>
    </swiper-item>
</swiper>
<!-- 九宫格区域 -->
<view class="gridList">
    <view class="gridItem" wx:for="{{gridList}}" wx:key="id">
        <image src="{{item.icon}}"></image>
        <text>{{item.name}}</text>
    </view>
</view>
<!-- 图片区域 -->
<view class="imagebox">
    <image src="/images/link01.png" mode="widthFix"></image>
    <image src="/images/link02.png" mode="widthFix"></image>
</view>
/* pages/home/home.wxss */
swiper {
    height: 350rpx;
}

swiper image {
    width: 100%;
    height: 100%;
}

.gridList {
    display: flex;
    flex-wrap: wrap;
    border-left: 1rpx solid #efefef;
    border-top: 1rpx solid #efefef;
}

.gridItem {
    width: 33.333%;
    height: 200rpx;
    /* 允许元素自由排布 */
    display: flex;
    /* 各元素之间纵向排布 */
    flex-direction: column;
    /* 美食与图片横向居中 */
    align-items: center;
    /* 美食与图片纵向居中 */
    justify-content: center;
    /* 对每个元素加一个右侧和下侧的边框 */
    border-right: 1rpx solid #efefef;
    border-bottom: 1rpx solid #efefef;
    /* 改变盒子方式 */
    box-sizing: border-box;
}

.gridItem image {
    width: 60rpx;
    height: 60rpx;
}

.gridItem text {
    font-size: 24rpx;
    /* 文本与图片之间存在距离 */
    margin-top: 10rpx;
}

.imagebox {
    /* 横向展示 */
    display: flex;
    padding: 10rpx 20rpx;
    justify-content: space-around;
}

.imagebox image {
    width: 45%;
}
{
    "pages": [
        "pages/home/home",
        "pages/message/message",
        "pages/contact/contact"
    ],
    "window": {
        "navigationBarTextStyle": "white",
        "navigationBarTitleText": "本地生活",
        "navigationBarBackgroundColor": "#abccba",
        "enablePullDownRefresh": true
    },
    "tabBar": {
        "list": [{
                "text": "首页",
                "iconPath": "/images/2.png",
                "selectedIconPath": "/images/2.2.png",
                "pagePath": "pages/home/home"
            },
            {
                "text": "消息",
                "iconPath": "/images/3.png",
                "selectedIconPath": "/images/3.2.png",
                "pagePath": "pages/message/message"
            },
            {
                "text": "联系我们",
                "iconPath": "/images/1.png",
                "selectedIconPath": "/images/1.2.png",
                "pagePath": "pages/contact/contact"
            }
        ]
    },
    "style": "v2",
    "componentFramework": "glass-easel",
    "sitemapLocation": "sitemap.json",
    "lazyCodeLoading": "requiredComponents"
}
// pages/home/home.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        //存放轮播图数据的列表
        swiperList: [],
        //存放九宫格数据的
        gridList: [],
    },
    //获取轮播图数据的方法
    getSwiperList() {
        wx.request({
            url: 'https://applet-base-api-t.itheima.net/slides',
            "method": "GET",
            success: (res) => {
                console.log(res)
                this.setData({
                    swiperList: res.data
                })
            }
        })
    },
    //获取九宫格数据的方法
    getGridList() {
        wx.request({
            url: 'https://applet-base-api-t.itheima.net/categories',
            method: "GET",
            success: (res) => {
                console.log(res)
                this.setData({
                    gridList: res.data
                })
            }
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onl oad(options) {
        this.getSwiperList(),
            this.getGridList()
    },

 

标签:flex,res,images,home,2.7,pages,png
From: https://www.cnblogs.com/zzqq1314/p/18011197

相关文章

  • 寒假day6 2.7_2
    讲师:施开成,CTSCrk6!!!数学01分数规划USACO18OPEN二分答案,转化答案,发现\(\sum(w_i-ct_i)\ge0\)随后背包解决问题。数论模\(p\)意义:忽略一个数的具体值,只关心在对\(p\)做除法后的余数。对于模合数,一定要避免除法。逆元将\(\frac{a}{b}\)视为\(a\times(\frac{1}{......
  • 寒假day6 2.7
    图论割点,割边如果删去一点,整个图的连通块数量增加,即是割点。只有环上的边不是割边。tarjandfs树上不存在横叉边,只有反祖边。判断一点是否是割点对于一点,判断它的子树中是否有能连接到该点上方的返祖边。记录\(low_y\)代表子树中能回溯到的最小的dfn值。判断:\(low_n>......
  • windows上使用python2.7获取svn info,中文路径乱码问题
    #-*-coding:utf-8-*-from__future__importunicode_literalsimportsubprocessimportcmdimportosos.environ['LANG']='en_US.UTF-8'classSVNCommand(cmd.Cmd):defdo_svninfo(self,folder_path):#构建svninfo命令......
  • vue2.x项目升级到2.7
    背景老代码库了,但是升级到v3的话成本比较大,准备先升级到2.7,用上compositon-api,后续再引入ts,慢慢改过来。改动点//package.json{..."vue":"^2.7.0",..."vue-template-compiler":"^2.6.10",//移除掉,用不上了"vue-loader":"^15.10.0&quo......
  • macOS Monterey 12.7.3 (21H1015) 正式版发布,ISO、IPSW、PKG 下载 (安全更新)
    macOSMonterey12.7.3(21H1015)正式版发布,ISO、IPSW、PKG下载1月22日,北京时间今日凌晨,macOSSonoma14.3发布,同时带来了macOSMonterey12.7.3和macOSVentru13.6.4安全更新。本站下载的macOS软件包,既可以拖拽到Applications(应用程序)下直接安装,也可以制作启动U......
  • macOS Monterey 12.7.3 (21H1015) Boot ISO 原版可引导镜像下载
    macOSMonterey12.7.3(21H1015)BootISO原版可引导镜像下载1月22日,北京时间今日凌晨,macOSSonoma14.3发布,同时带来了macOSMonterey12.7.3和macOSVentru13.6.4安全更新。本站下载的macOS软件包,既可以拖拽到Applications(应用程序)下直接安装,也可以制作启动U盘......
  • springboot升级到2.6.x和2.7.x 兼容hystrix
    一、pom.xml需要引入的依赖二、项目开启熔断器开关2.1注解方式2.2xml方式三、依赖类缺失问题四、版本匹配安全检查问题五、测试验证六、结论一、pom.xml需要引入的依赖1<!--springboot升级到2.6.7,同样适用于2.7.0,2.7.18等-->2<parent>3......
  • [Windows] 视频拍摄必备神器,桌面提词器(TelePrompter)-2.7.1
    随着短视频内容的兴起,越来越多的小伙伴开始尝试拍摄视频。但没有足够的经验,可能面对镜头就懵了,不仅磕巴,还会忘词。今天介绍的这款工具是主持人、记者常用的桌面提词器,有做短视频或直播的小伙伴可以试试这款免费工具。TelePrompter是一款易于使用、功能强大的现代Windows文本/演......
  • Springboot 2.7 open api:swagger | knife4j | spring doc
    *[集成SpringDoc接口文档和knife4j|SpringBoot2.7.2实战基础-掘金](https://juejin.cn/post/7201195677128687674)*[Springboot2.7集成Swagger增强版接口框架Knife4j4.3+springdocOpenApi3.0\_knife4jspringboot2.7-CSDN博客](https://blog.csdn.net/Mrqi......
  • macOS Monterey 12.7 (21G816) Boot ISO 原版可引导镜像
    macOSMonterey12.7(21G816)BootISO原版可引导镜像本站下载的macOS软件包,既可以拖拽到Applications(应用程序)下直接安装,也可以制作启动U盘安装,或者在虚拟机中启动安装。另外也支持在Windows和Linux中创建可引导介质。2023年9月22日,Apple为macOS和iOS等旧版......