当前位置: 首页 > wzjs >正文

网站建设快速便宜广州网络营销的推广

网站建设快速便宜,广州网络营销的推广,浦口区网站建设质量推荐,浏览器大全网址参考文档 微信小程序相关开发文档链接:https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html 虽然是uniapp框架但是实现方式和原生小程序相似 实现思路 1、app.json里面tabBar添加配置 custom:true,其他和非自定义设置一样 2、在…

参考文档

微信小程序相关开发文档链接:https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html
虽然是uniapp框架但是实现方式和原生小程序相似

实现思路

1、app.json里面tabBar添加配置 custom:true,其他和非自定义设置一样
2、在components文件夹里添加Tabbar组件
3、在对应的页面里引用Tabbar组件

pages.json 配置代码

{"tabBar": {"custom": true, //必写"color": "#000000",   //color,selectedColor,backgroundColor可不写"selectedColor": "#000000", //tab选中颜色"backgroundColor": "#000000","list": [{ //每个tab对应的路由路径"pagePath": "page/index/index",//此处page前面未加/"text": "首页"}, {"pagePath": "page/index/order","text": "订单"},{"pagePath": "page/index/myUser","text": "我的"},]},
}

Tabbar组件代码

HTML代码

<template><u-tabbar :value="activeIndex" fixed activeColor="#11C0D7" inactiveColor="#8C8C8C"><u-tabbar-itemv-for="(item, index) in tabList":text="item.text":key="index":border="false"@click="tabBarChange(item.pagePath, index)"><template #active-icon><image class="u-page__item__slot-icon" :src="item.selectedIconPath"></image></template><template #inactive-icon><image class="u-page__item__slot-icon" :src="item.iconPath"></image></template></u-tabbar-item></u-tabbar>
</template>

JS代码

<script setup lang="ts">
import { onShow } from '@dcloudio/uni-app'
import { ref } from 'vue'
const tabList = ref([{pagePath: 'index',text: '首页',iconPath: '../../static/images/index.png', //本地图片selectedIconPath: '../../static/images/index_select.png'},{pagePath: 'order',text: '订单',iconPath: '../../static/images/order.png',selectedIconPath: '../../static/images/order_select.png'},{pagePath: 'myUser',text: '我的',iconPath: '../../static/images/user.png',selectedIconPath: '../../static/images/user_select.png'}
])
const activeIndex = ref(0) //当前选中项
onShow(() => {getActiveIndex()
})// 自定义tab组件监听页面路径选中下标
const getActiveIndex = () => {const pages = getCurrentPages()let page = pages[pages.length - 1]tabList.value.forEach((item: any, index: number) => {if (`pages/index/${item.pagePath}` == page.route) {activeIndex.value = index}})
}function tabBarChange(url: string, index: number) {uni.switchTab({url})
}
</script>

在页面中引入

<!-- 每个tabbar对应的路由页面,page最好添加 padding-bottom:calc(env(safe-area-inset-bottom) + 24rpx + 50px); 50是设置的tabbar的高度,24是留余的页面空白 --><template><TabBar />
</template>
<script setup lang="ts">import TabBar from '@/components/Tabbar/index.vue'</script>
http://www.dtcms.com/wzjs/6092.html

相关文章:

  • 门户网站做菏泽资深seo报价
  • 学校网站建设搜狗竞价推广效果怎么样
  • 网站的域名用文字搜索怎么做百度高级搜索指令
  • 国内优秀网站赏析搜狗seo查询
  • 个人做地方门户网站外贸出口平台网站
  • 手把手教你做网站青岛关键词排名系统
  • mt4网站建设网络服务主要包括什么
  • 上海哪家网站建设比较好营销渠道的三个类型
  • 山东企业网站建设广东疫情防控措施
  • dede替换网站模板各大网站排名
  • 营销型网站建设制作营销运营主要做什么
  • 网站怎么才能被百度收录免费推广
  • 下载网站模板国内最新新闻事件
  • 一些做义工的旅游网站专业网络推广公司排名
  • 网站怎么做英语和中文的b2b网站大全免费推广
  • 沙田做网站关键词异地排名查询
  • discuz网站伪静态设置东莞网站推广大全
  • 河北省衡水市景县规划网站域名解析在线查询
  • 钟村免费建站公司seo关键词排名价格
  • 网站交给别人做安全吗重庆人力资源和社会保障网
  • 网站建设模板是什么搜索引擎关键词优化方案
  • 做网站一般几个步骤网络营销是指什么
  • 网站图片在手机上做多大最清晰seo目标关键词优化
  • 公益慈善网站建设方案职业培训机构
  • 给企业做网站运营友情下载网站
  • 网站设计的基本流程是什么互联网营销师国家职业技能标准
  • 网站开发行业信息网国外搜索引擎大全
  • 杭州网站建设方案百度seo报价方法
  • 花钱做网站注意湖南seo优化公司
  • 济南疫情太厉害了常州百度关键词优化