H5仿微信界面好代码教程(一)

秋天是金灿灿的丰收,秋天是沉甸甸的硕果,秋天是让人满载而归的欢笑和欣喜。

前言

先来张图,仿微信界面,界面如下,并不完全一模一样,只能说有些类似,希望大家见谅。

1 用到的知识点

jQuery WeUI 是WeUI的一个jQuery实现版本,除了实现了官方插件之外,它还提供了如下拉刷新、日历、地址选择器等丰富的拓展组件。jQuery WeUI 中的JS组件均是以JQuery 插件的形式提供,使用非常方便,并且可以和React、Angular、VUE之类的主流JS框架一起使用。

WeUI 是微信官方团队针对微信提供的一个H5 UI库,它只提供了一组CSS组件。jQuery WeUI 中使用的是官方WeUI的CSS代码,并提供了jQuery/Zepto版本的API实现。因为直接使用了官方的CSS,所以你不用担心跟官方版本的冲突。实际上 jQuery WeUI == WeUI + jQuery插件。

Font Awesome 是一套完美的图标字体,主要目的是和 Bootstrap 搭配使用。

2 引入样式文件

<link rel="nofollow noopener noreferrer" href="static/lib/weui.css" rel="stylesheet" type="text/css" /> 
<link rel="nofollow noopener noreferrer" href="static/css/jquery-weui.css" rel="stylesheet" type="text/css" /> 
<link rel="nofollow noopener noreferrer" href="static/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css" />

3 先说底部菜单

<div class="weui-tabbar"> 
<a rel="nofollow noopener noreferrer" href="wx-wx.html" class="weui-tabbar__item "> <span class="weui-badge" style="position: absolute;top: -.4em;right: 1em;">8</span> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-comment-o fa-fw" style=" "></i> 
</div> <p class="weui-tabbar__label">微信</p> </a> 
<a rel="nofollow noopener noreferrer" href="wx-tongxulv.html" class="weui-tabbar__item"> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-vcard-o" style=" "></i> 
</div> <p class="weui-tabbar__label">通讯录</p> </a> 
<a rel="nofollow noopener noreferrer" href="#tab3" class="weui-tabbar__item"> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-compass " style=""></i> 
</div> <p class="weui-tabbar__label">发现</p> </a> 
<a rel="nofollow noopener noreferrer" href="wx-user.html" class="weui-tabbar__item weui-bar__item--on"> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-user" style=" color:#0dba08;"></i> 
</div> <p class="weui-tabbar__label" style=" color:#0dba08;">我</p> </a> 
</div>

4 头部代码

<nav class="blue nav" style=" "> 
<a id="topPopovershow" rel="nofollow noopener noreferrer" href="#" class="button button-link right "> <i class="fa fa-plus fa-fw" style=" font-size:20px;" ></i> </a> 
<h1 class="title">微信</h1> 
</nav>

5 主体部分

<div class="page-content"> 
<div class="weui-cells" style="margin-top: 0px;">
<a class="weui-cell weui-cell_access open-popup weui-popup-modal " data-target="#full" rel="nofollow noopener noreferrer" href="javascript:;">
<div class="weui-cell__hd">
<img width="48px;" class="weui-media-box__thumb" src="images/timg5.jpg" alt="" class="self-header">
</div>
<div class="weui-cell__bd">
<div style=" margin-left:10px;">

<h4 class="weui-media-box__title">小楼听春雨菩提本无树</h4>
<p class="weui-media-box__desc" >菩提本无树,明镜</p>

</div> 
</div>
<div class="weui-cell__ft">22:55</div>
</a>

<a class="weui-cell weui-cell_access" rel="nofollow noopener noreferrer" href="javascript:;">
<div class="weui-cell__hd">
<img width="48px;" class="weui-media-box__thumb" src="images/timg2.jpg" alt="" class="self-header">
</div>
<div class="weui-cell__bd">
<div style=" margin-left:10px;">

<h4 class="weui-media-box__title">听春雨</h4>
<p class="weui-media-box__desc" >大家聊聊天今天下雨了</p>

</div> 
</div>
<div class="weui-cell__ft">22:55</div>
</a>
</div>

6 头部css

.nav {
position: fixed;
right: 0;
left: 0;
z-index: 10;
height: 2.2rem;
padding-right: .5rem;
padding-left: .5rem;
background-color: #0993c7;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
color: #FFF;
background-color: #20a0ff;
}

本文H5仿微信界面好代码教程(一)到此结束。既然时间是最宝贵的财富,那么珍惜时间,合理地运用时间就很重要,如何合理地花费时间,就如同花钱的规划一样重要,钱花完了可再挣,时间花完了就不能再生,因此,更要利用好你的时间。小编再次感谢大家对我们的支持!

标签: 仿微信