小程序weui badge单行列表

2018年09月26日 08:57 | 3567次浏览 作者原创 版权保护

微信小程序weui badge单行列表页在平时页面制作中用到的还是比较频繁的,但实现起来也很简单,实现如下

一、引入小程序weui css样式库,请参考第一章


二、在pages目录中新建目录badge以及文件badge.wxml,并添加如下代码

<view class="page">
<view class="page__hd">
<view class="page__title">Badge</view>
<view class="page__desc">徽章(V型知识库原创 www.vxzsk.com)</view>
</view>

<view class="page__bd">
<view class="weui-cells__title">新消息提示跟摘要信息后,统一在列表右侧</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd">单行列表</view>
<view class="weui-cell__ft weui-cell__ft_in-access" style="font-size: 0">
<view style="display: inline-block;vertical-align:middle; font-size: 17px;">详细信息</view>
<view class="weui-badge weui-badge_dot" style="margin-left: 5px;margin-right: 5px;"></view>
</view>
</view>
</view>

<view class="weui-cells__title">未读数红点跟在主题信息后,统一在列表左侧</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__hd" style="position: relative;margin-right: 10px;">
<image src="../images/pic_160.png" style="width: 50px; height: 50px; display: block"/>
<view class="weui-badge" style="position: absolute;top: -.4em;right: -.4em;">8</view>
</view>
<view class="weui-cell__bd">
<view>联系人名称</view>
<view style="font-size: 13px;color: #888888;">摘要信息</view>
</view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd">
<view style="display: inline-block; vertical-align: middle">单行列表</view>
<view class="weui-badge" style="margin-left: 5px;">8</view>
</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd">
<view style="display: inline-block; vertical-align: middle">单行列表</view>
<view class="weui-badge" style="margin-left: 5px;">8</view>
</view>
<view class="weui-cell__ft weui-cell__ft_in-access">详细信息</view>
</view>
<view class="weui-cell weui-cell_access">
<view class="weui-cell__bd">
<view style="display: inline-block; vertical-align: middle">单行列表</view>
<view class="weui-badge" style="margin-left: 5px;">New</view>
</view>
<view class="weui-cell__ft weui-cell__ft_in-access"></view>
</view>
</view>
</view>
</view>


二、在根目录app.json配置文件中配置badge文件路径

"pages/badge/badge",


三、预览效果

如上图,单行列表的红色消息提示,箭头等效果已经出来了,手机预览还不错。



小说《我是全球混乱的源头》
此文章本站原创,地址 https://www.vxzsk.com/1894.html   转载请注明出处!谢谢!

感觉本站内容不错,读后有收获?小额赞助,鼓励网站分享出更好的教程