小程序是什么?

微信小程序,是一种不需要下载安装即可使用的应用,用户扫一扫或搜一下即可打开应用,在微信-发现-小程序可打开应用。

一.小程序的样式编写:

目录结构:

app.json

 {
"pages": [
"pages/index/index",
"pages/message/message",
"pages/userCenter/userCenter",
"pages/contact/contact"
],
"window": {
"navigationBarBackgroundColor": "#13d1be",
"navigationBarTextStyle": "black",
"navigationBarTitleText":"本地宝",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light",
"enablePullDownRefresh": false
},
"tabBar": {
"selectedColor":"rgb(238, 82, 61)",
"list": [{
"pagePath": "pages/index/index",
"text": "主页",
"iconPath": "tabs/home.png",
"selectedIconPath": "tabs/home-active.png"
},
{
"pagePath": "pages/message/message",
"text": "消息",
"iconPath": "tabs/message.png",
"selectedIconPath": "tabs/message-active.png"
},
{
"pagePath": "pages/userCenter/userCenter",
"text": "我的",
"iconPath": "tabs/profile.png",
"selectedIconPath": "tabs/profile-active.png"
},
{
"pagePath": "pages/contact/contact",
"text": "联系我们",
"iconPath": "tabs/contact.png",
"selectedIconPath": "tabs/contact-active.png"
}
]
}
}

公共样式:

 /*公共的样式  */
/*伪元素边框-不占位置 */
.bd-r,.bd-t{
position: relative;
} .bd-r::after,.bd-t::before{
content: "";
position: absolute;
left:0;
top:0;
width: 100%;
height: 1rpx;
background-color: rgb(239, 239, 239);
} .bd-r::before{
right: 0;
left: auto;
width:1rpx;
height: 100%;
} .h100-block{
height: 10rpx;
background-color: #f0f0f0;
} /*利用flex伸缩盒属性,实现栅格化布局 */
.row{
display: flex;
} .row .col{
flex: 1;
}

主页页面编写:

index.wxml

 <!--pages/index/index.wxml-->
<block>
<swiper indicator-dots="true" autoplay="true" interval="3000" duration="500" indicator-color='#f99' indicator-active-color='#f11' circular='true'>
<swiper-item>
<image src="../../images/banner-01.png" width="375" height="150" />
</swiper-item>
<swiper-item>
<image src="../../images/banner-02.png" width="375" height="150" />
</swiper-item> <swiper-item>
<image src="../../images/banner-01.png" width="375" height="150" />
</swiper-item>
<swiper-item>
<image src="../../images/banner-02.png" width="375" height="150" />
</swiper-item>
</swiper>
</block> <block>
<view class='index-nav'>
<navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-01.png'></image>
<text>美食</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-02.png'></image>
<text class='xizu'>洗浴足疗</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-03.png'></image>
<text class='jiehuntxt'>结婚啦</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-04.png'></image>
<text class='ktvtxt'>KTV</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-05.png'></image>
<text class='findworktext'>找工作</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-06.png'></image>
<text class='fudao'>辅导班</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-07.png'></image>
<text class='qichetext'>汽车保养</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-08.png'></image>
<text>租房</text>
</view>
</navigator> <navigator>
<view class='img bd-r bd-t'>
<image src='../../icons/grid-09.png'></image>
<text>装修</text>
</view>
</navigator>
</view>
</block>
<view class='h100-block'></view> <view class='index-enter row'> <view class='col'>
<navigator>
<image src='../../images/link-01.png'></image>
</navigator>
</view> <view class='col'>
<navigator>
<image src='../../images/link-02.png'></image>
</navigator>
</view>
</view>

主页样式:index.wxss

 /* pages/index/index.wxss */
swiper-item image{
width: 750rpx;
height: 340rpx;
}
.index-nav{
overflow: hidden;
}
.img{
text-align: center;
font-size: 14px;
float: left;
width:33.3%;
height: 198rpx; /* box-sizing: border-box;
border-left: 1rpx solid rgb(239, 239, 239);
border-bottom: 1rpx solid rgb(239, 239, 239); */
}
/*选择第三个元素的倍数,把修饰用的边框隐藏 */
/*nth-of-type:选中类型的的第几个
::before需要配合content:''使用 */
.img:nth-of-type(3n)::before{
background-color: transparent;
} .img image{
width: 90rpx;
height: 90rpx;
display: block;
margin: 40rpx auto 20rpx;
} .img text{
display: block;
} .xizu{
left: 21%!important;
}
.jiehuntxt{
left: 29%!important;
} .findworktext{
left: 29%!important;
}
.fudao{
left: 29%!important;
}
.qichetext{
left: 21%!important;
} .index-enter image{
width: 320rpx;
height: 175rpx;
} .index-enter{
text-align: center;
padding: 10rpx ;
}

微信小程序--轮播图,标题,盒子,tab栏的合成例子的更多相关文章

  1. 图解微信小程序---轮播图

    图解微信小程序---轮播图 代码笔记 第一步:在页面创建swiper组件 第二步:编写js页面 注意事项:wx:for渲染我们js中的图片数组,item默认写法,获取我们的图片数组中的图片,可通过增加 ...

  2. 微信小程序------轮播图

    swiper 微信小程序实现轮播图,和网站,APP的效果差不多,代码少,效率高. 先来看看效果图: 主要用swiper + swiper-item来实现 <view class='swiper' ...

  3. 微信小程序——轮播图实现

    小程序的轮播图,也就是他其中的一个控件可以算是直接上代码: 这是WXML 页面 代码: <view class='carousel_div'> <swiper class=" ...

  4. 微信小程序轮播图的制作与跳转

    <!--轮播图 --> <view class='swiperBanner'> <swiper indicator-dots='{{indicatorDots}}' au ...

  5. 微信小程序轮播图组件 swiper,swiper-item及轮播图片自适应

    官网地址:https://developers.weixin.qq.com/miniprogram/dev/component/swiper.html index.wxml文件 indicator-d ...

  6. 微信小程序轮播图

    swiper标签 <!--index.wxml--> <swiper class="swiper" indicator-dots="true" ...

  7. 一分钟学会如何自定义小程序轮播图(蜜雪冰城Demo)

    最近开发小程序项目用到了轮播图,默认的有点单调,作为后端程序员,研究一番最终实现了.本文会从思路,代码详细介绍,相信读过此文后,不管以后在开发中碰到轮播图还是需要自定义修改其他的样式都可以按这个思路解 ...

  8. 02微信小程序-轮播的宽度100%显示和轮播的基础配置

    1==>如何让轮播的宽度100%显示? 你先给swiper 外面添加一个大盒子,给大盒子一个类 . <view class='lunbobox'> 然后wxss 里面设置 image ...

  9. 微信小程序轮播组件

    在index.wxml中添加以下代码 <view> <swiper indicator-dots="{{indicatorDots}}" autoplay=&qu ...

随机推荐

  1. LocalSessionFactoryBean有几个属性查找hibernate映射文件

    LocalSessionFactoryBean有几个属性查找hibernate映射文件: mappingResources.mappingLocations.mappingDirectoryLocat ...

  2. 08_jQuery对象初识(四)each循环、data(非常重要)

    each: 不使用for循环答应jQuery对象,使用each: 退出整个each循环: 退出一次each循环: data:

  3. C#去掉字符串两端空格以及去掉字符串中多余空格保留一个空格

    string str = " asdf asd saddf sdfwrqeqw a asdf "; string[] strs = str.Trim().Split(new cha ...

  4. 《数据结构与算法分析——C语言描述》ADT实现(NO.04) : AVL树(AVL-Tree)

    上次我们已经实现了普通的二叉查找树.利用二叉查找树,可以用O(logN)高度的树状结构存储和查找数据,提高了存储和查找的效率. 然而,考虑一种极端情形:依次插入1,2,3,4,5,6,7,8,9九个元 ...

  5. 廖雪峰Java10加密与安全-4加密算法-4密钥交换算法

    1DH算法 1.1.原根公式:g^i mod P 条件:1<g<P,0<i<P 原根:介于[1, p-1]之间的任意2个数i,j(p为素数,i≠j)的结果不相等,即 g^i m ...

  6. HZOI20190829模拟33题解

    题面:https://www.cnblogs.com/Juve/articles/11436771.html A:春思 我们对a分解质因数,则$a=\prod\limits_p^{p|a}p^k$ 所 ...

  7. Vue的Ajax(vue-resource/axios)

    一 简介 1.vue本身不支持发送AJAX请求,需要使用vue-resource(vue1.0版本).axios(vue2.0版本)等插件实现 2.axios是一个基于Promise的HTTP请求客户 ...

  8. 在skyline中将井盖、雨水箅子等部件放到地面模型上

    公司三维建模组遇到这样的一个问题,怎样将井盖.雨水盖子恰好放在做好的地面模型上.传统的方法是在skyline中逐个调整井盖的对地高度,就是调整为恰好能放在地面上.或者选择很粗糙的一个方法,在“高度”属 ...

  9. Python爬虫工程师必学——App数据抓取实战

    Python爬虫工程师必学 App数据抓取实战 整个课程都看完了,这个课程的分享可以往下看,下面有链接,之前做java开发也做了一些年头,也分享下自己看这个视频的感受,单论单个知识点课程本身没问题,大 ...

  10. VC++1.5太伟大了

    功能样样俱全,一点不比现在的VS系列差 VC++1.5全貌,虽然很古老,但是已经可以了. 新建的文档试图,多文档工程,很像样 文档试图,单文档工程,已经非常像样了,和记事本差不多了 这是资源编辑器,寒 ...