因大量使用者反馈此布局封装为组件后改进反而麻烦,我们取消了此组件,转为样式布局,这样更方便大家改进、使用;
1. 打开 https://www.iconfont.cn/;
2. 搜索选择需要的图标;
3. 下载图标 (白色、宽度200px);
4. 将图标文件部署到自己的云或项目内获得图片路径;
| H5 | APP | 小程序 | NVUE |
| ✔ | ✔ | ✔ | ✔ |
<template>
<view class="gui-padding">
<view class="gui-margin-top">
<text class="gui-h6 gui-color-gray">布局演示</text>
</view>
<view class="gui-flex gui-rows gui-wrap gui-space-between gui-margin-top">
<view class="gui-ic-item gui-border-box"
:style="{backgroundColor:item.bgColor}"
v-for="(item, index) in classes" :key="index">
<image :src="item.icon"
class="gui-ic-image" mode="widthFix"></image>
<view class="gui-ic-content gui-flex gui-rows gui-align-items-end">
<text class="gui-ic-title gui-color-white">{{item.txt}}</text>
<text class="gui-text-small gui-color-white">{{item.smallTxt}}</text>
</view>
<image :src="item.icon" class="gui-ic-bg-image" mode="widthFix"></image>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
classes : [
{
icon:'https://graceui.oss-cn-beijing.aliyuncs.com/classes/font.png',
txt:'字体', smallTxt:"Font", bgColor:"#6DCD70",
path:"../index/index?test=1", openType:"switchTab"
},
{
icon:'https://graceui.oss-cn-beijing.aliyuncs.com/classes/tmp.png',
txt:'主题', smallTxt:"Theme", bgColor:"#F596DB",
path:"./index?test=1", openType:"navigate"
},
{
icon:'https://graceui.oss-cn-beijing.aliyuncs.com/classes/mall.png',
txt:'商城', smallTxt:"Mall", bgColor:"#4D5CBC",
path:"./index?test=1", openType:"navigate"
},
{
icon:'https://graceui.oss-cn-beijing.aliyuncs.com/classes/msg.png',
txt:'消息', smallTxt:"Message", bgColor:"#DCD64E",
path:"./index?test=1", openType:"navigate"
},
{
icon:'https://graceui.oss-cn-beijing.aliyuncs.com/classes/card.png',
txt:'名片', smallTxt:"Card", bgColor:"#C4A6FB",
path:"./index?test=1", openType:"navigate"
},
{
icon:'https://graceui.oss-cn-beijing.aliyuncs.com/classes/lady.png',
txt:'女装', smallTxt:"Lady", bgColor:"#9CDDEA",
path:"./index?test=1", openType:"navigate"
}
]
}
},
methods:{}
}
</script>
<style scoped>
.gui-ic-item{width:210rpx; height:158rpx; padding:20rpx; font-size:0; border-radius:5px; margin-bottom:25rpx; position:relative;}
.gui-ic-image{width:60rpx; height:56rpx;}
.gui-ic-bg-image{width:70rpx; height:66rpx; position:absolute; opacity:0.1; right:6px; bottom:6px;}
.gui-ic-content{padding:10rpx 0rpx;}
.gui-ic-title{font-size:28rpx; margin-right:3px;}
</style>