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

恩施网站制作公司中国万网域名注册免费

恩施网站制作公司,中国万网域名注册免费,常用的网站制作,阿里云wordpress安装目录一、效果展示: 二、代码实现: 1.首先在pages.json文件中进行tabbar的样式和列表配置,代码如下: {"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/p…

一、效果展示:

在这里插入图片描述

二、代码实现:

1.首先在pages.json文件中进行tabbar的样式和列表配置,代码如下:

{"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages{"path": "pages/index/index","style": {"navigationBarTitleText": "uni-app"}},{"path": "pages/todo/todo","style": {"navigationBarTitleText": "uni-app"}},{"path": "pages/workBench/workBench","style": {"navigationBarTitleText": "uni-app"}},{"path": "pages/contacts/contacts","style": {"navigationBarTitleText": "uni-app"}},{"path": "pages/my/my","style": {"navigationBarTitleText": "uni-app"}}],"tabBar": {"color": "#B6C3D2","selectedColor": "#2B2E3D","borderStyle": "black","backgroundColor": "#FFFFFF","list": [{"pagePath": "pages/index/index","iconPath": "static/index01.png","selectedIconPath": "static/index02.png","text": "首页"},{"pagePath": "pages/todo/todo","iconPath": "static/dd01.png","selectedIconPath": "static/dd02.png","text": "订单1"},{"pagePath": "pages/workBench/workBench","iconPath": "static/shop01.png","selectedIconPath": "static/shop02.png","text": "店铺"},{"pagePath": "pages/contacts/contacts","iconPath": "static/dd01.png","selectedIconPath": "static/dd02.png","text": "订单2"},{"pagePath": "pages/my/my","iconPath": "static/my01.png","selectedIconPath": "static/my02.png","text": "我的"}]},"globalStyle": {"navigationBarTextStyle": "black","navigationBarTitleText": "uni-app","navigationBarBackgroundColor": "#F8F8F8","backgroundColor": "#F8F8F8"},"uniIdRouter": {}
}

2.在components文件中封装一个Tabbar 组件,命名为TabBar.vue 代码如下:

<template><view class="tabbar-container"><block><view class="tabbar-item" v-for="(item,index) in tabbarList":class="[item.centerItem ? ' center-item' : '']" @click="changeItem(item)"><view class="item-top"><image :src="currentItem==item.id?item.selectIcon:item.icon"></image></view><view class="item-bottom" :class="[currentItem==item.id ? 'item-active' : '']"><text>{{item.text}}</text></view></view></block></view>
</template><script>export default {props: {currentPage: {type: Number,default: 0}},data() {return {currentItem: 0,tabbarList: [{id: 0,path: "/pages/index/index",icon: "/static/index01.png",selectIcon: "/static/index02.png",text: "首页",centerItem: false}, {id: 1,path: "/pages/todo/todo",icon: "/static/dd01.png",selectIcon: "/static/dd02.png",text: "订单1",centerItem: false}, {id: 2,path: "/pages/workBench/workBench",icon: "/static/shop01.png",selectIcon: "/static/shop02.png",text: "店铺",centerItem: true}, {id: 3,path: "/pages/contacts/contacts",icon: "/static/dd01.png",selectIcon: "/static/dd02.png",text: "订单2",centerItem: false}, {id: 4,path: "/pages/mine/mine",icon: "/static/my01.png",selectIcon: "/static/my02.png",text: "我的",centerItem: false}]};},mounted() {this.currentItem = this.currentPage;uni.hideTabBar();},methods: {changeItem(item) {let _this = this;//_this.currentItem = item.id;  uni.switchTab({url: item.path});console.log(item.path)}}}
</script>
<style>view {padding: 0;margin: 0;box-sizing: border-box;}.tabbar-container {position: fixed;bottom: 0;left: 0;width: 100%;height: 110rpx;/* box-shadow: 0 0 5px #999;  */box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.16);border-top: 1px;display: flex;align-items: center;padding: 5rpx 0;color: #999999;z-index: 200;background-color: #fff;}.tabbar-container .tabbar-item {width: 20%;height: 100rpx;display: flex;flex-direction: column;justify-content: center;align-items: center;text-align: center;}.tabbar-container .item-active {color: #1AD080;}.tabbar-container .center-item {display: block;position: relative;}.tabbar-container .tabbar-item .item-top {width: 54rpx;height: 54rpx;padding: 0rpx;}.tabbar-container .center-item .item-top {flex-shrink: 0;width: 100rpx;height: 100rpx;position: absolute;top: -50rpx;left: calc(50% - 50rpx);border-radius: 50%;box-shadow: 0px 3px 20px rgba(0, 0, 0, 0.16);/* box-shadow: 0 0 5px #999;  */background-color: #ffffff;padding: 10rpx;}.tabbar-container .tabbar-item .item-top image {width: 100%;height: 100%;}tabbar-container .tabbar-item:nth-child(3) .item-top image {background: #ff0000;}.tabbar-container .tabbar-item .item-bottom {font-size: 28rpx;width: 100%;}.tabbar-container .center-item .item-bottom {position: absolute;bottom: 5rpx;}
</style>

3.在mian.js 全局注册组件

import TabBar from "./components/TabBar.vue"
Vue.component('TabBar', TabBar);  

4.在页面中使用组件

<TabBar :current-page="0" />

完成~

http://www.15wanjia.com/news/3436.html

相关文章:

  • 文件下载网站源码班级优化大师
  • 上海哪家网站建设公司好百度快照投诉中心官网
  • b2b网站建设内容论文淄博seo
  • 零食网站源码专业精准网络营销推广
  • 网站建设7个基本流程图实体店铺引流推广方法
  • 如何在ftp做网站网站一键收录
  • 广东网站建设便捷百度网络营销推广
  • 杭州网站建设哪家靠谱怎么自己建立网站
  • 广东省住房和城乡建设部网站营销新闻
  • 政府类网站设计有什么要点营销培训方案
  • 广州网站建设集团百度联盟是什么
  • 镇江网站制作哪家便宜杭州seo外包
  • php如何做局域网的网站建设浙江seo关键词
  • 一个人做网站建设需掌握seo页面优化公司
  • 游戏网站怎么做seo合肥seo推广排名
  • 深圳网站备案点可以免费发广告的网站有哪些
  • 怎么做兼职网站营销咨询师
  • 做微信公众号网站新手电商运营从哪开始学
  • 代理网店成都seo工程师
  • 湖南平台网站建设找哪家直接进入网站的代码
  • 政府信息网站建设四川百度推广排名查询
  • wordpress个人中心打不开东莞网站建设优化诊断
  • 真人做爰直播全集播放网站鹤岗网站seo
  • 望京做网站的公司哪家好百度seo排名优化公司推荐
  • 做交通事故的网站广州网站seo地址
  • 网站推广究竟应该怎么做软文推广平台排名
  • 网站banner怎么做ps网站排名优化培训电话
  • 佛山低价网站建设市场营销策略
  • 人力资源网站怎么做手机怎么在百度上发布信息
  • 有哪些做婚礼电子请柬的网站大连企业黄页电话