微信小程序 之 用户自定义模版

1,新建一个wxml

<template name="bottommenu">
      <view class="bottomposition">
            <navigator  class="item_info" url="../home/home">
                  <image src="../img/sy.png"></image>
                  <text>首页</text>
            </navigator>


            <navigator  class="item_info" url="/pages/home/home">
                  <image  src="../img/xx.png"></image>
                  <text>消息</text>
            </navigator>


            <navigator  class="item_info" url="/pages/home/home">
                  <image src="../img/lz.png"></image>
                  <text>履职</text>
            </navigator>


            <navigator  class="item_info" url="/pages/home/home">
                  <image src="../img/wo.png"></image>
                  <text>我</text>
            </navigator>
      </view>
</template>

2,新建wxss

.bottomposition{
    width: 100%;
    height: 10%;
    position: fixed;
    overflow: hidden;
    left: 0;
    top: 90%;
z-index: 1100;
    display: flex;
    border-top: 1rpx solid #dadada;
}


.item_info {
    width: 25%;
    height: 100%;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
}


.item_info image {
    width: 20px;
    height: 20px;
}
.item_info text {
    margin-top: 5px;
    font-size: 12px;
}


3,页面引用


<import src="../common/bottommenu/botmenu.wxml"/>
<view class="info">
  <template is="bottommenu"></template>
</view>

4,页面样式引用

@import "../common/bottommenu/botmenu.wxss";


5,页面效果


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值