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

沧州网站建设代理价格中企动力官网登录

沧州网站建设代理价格,中企动力官网登录,seo排名培训公司,中医医院网站建设需求文章目录 1. 实现效果2. App.vue3. pages.json 配置自定义4. 顶部导航栏 使用 微信小程序自定义 navigationBar 顶部导航栏,兼容适配所有机型 1. 实现效果 2. App.vue 在App.vue 中,设置获取的 StatusBar,CustomBar 高度(实现适配…

文章目录

  • 1. 实现效果
  • 2. App.vue
  • 3. pages.json 配置自定义
  • 4. 顶部导航栏 使用

微信小程序自定义 navigationBar 顶部导航栏,兼容适配所有机型

1. 实现效果

在这里插入图片描述

2. App.vue

  1. 在App.vue 中,设置获取的 StatusBarCustomBar 高度(实现适配高度写法)
  2. uni.getSystemInfo 获取可视区域的高度
  3. wx.getMenuButtonBoundingClientRect() 胶囊按钮位置信息
<script>import Vue from 'vue'export default {onLaunch: function() {uni.getSystemInfo({success: function(e) {// #ifndef MPVue.prototype.StatusBar = e.statusBarHeight;if (e.platform == 'android') {Vue.prototype.CustomBar = e.statusBarHeight + 50;} else {Vue.prototype.CustomBar = e.statusBarHeight + 45;};// #endif// #ifdef MP-WEIXINVue.prototype.StatusBar = e.statusBarHeight;let custom = wx.getMenuButtonBoundingClientRect();Vue.prototype.Custom = custom;Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight + 4;// #endif		// #ifdef MP-ALIPAYVue.prototype.StatusBar = e.statusBarHeight;Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;// #endif}});},onShow: function() {console.log('App Show')},onHide: function() {console.log('App Hide')}}
</script><style lang="scss">
</style>

3. pages.json 配置自定义

"pages": [{"path": "home","style": {"navigationStyle": "custom"}
}]

4. 顶部导航栏 使用

  1. 组件完整代码(CSS 部分 我使用的是 colorUI ,不懂的可以看看写法)
<template><view><view class="cu-custom" :style="[{height:CustomBar + 'px'}]"><view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]"><view class="action" @tap="BackPage" v-if="isBack"><text class="cuIcon-back"></text><slot name="backText"></slot></view><view class="content" :style="[{top:StatusBar + 'px'}]"><slot name="content"></slot></view><slot name="right"></slot></view></view></view>
</template><script>export default {data() {return {StatusBar: this.StatusBar,CustomBar: this.CustomBar};},name: 'cu-custom',computed: {style() {var StatusBar = this.StatusBar;var CustomBar = this.CustomBar;var bgImage = this.bgImage;var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;if (this.bgImage) {style = `${style}background-image:url(${bgImage});`;}return style}},props: {bgColor: {type: String,default: ''},isBack: {type: [Boolean, String],default: false},bgImage: {type: String,default: ''},},methods: {BackPage() {uni.navigateBack({delta: 1});}}}
</script><style lang="scss" scoped>
</style>
  1. main.js 全局注册顶部导航栏组件
// 此处为引用自定义顶部
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom);
  1. 页面使用导航栏组件
<cu-custom class="navBox" bgColor="bg-gradual-blue" :isBack="true"><block slot="backText">返回</block><block slot="content">首页</block>
</cu-custom>
http://www.yayakq.cn/news/880366/

相关文章:

  • 网站建设公司 电话销售没什么效果asp access网站开发实例精讲
  • 购买主机可以做网站吗vi设计作品
  • 什么网站专做二手名表wordpress显示图片
  • 上市设计网站企业的建站方式
  • 网站建设和优化的步骤上海app定制哪家好
  • 国内知名的网站设计公司做一个网页需要什么技术
  • 网站开发开源框架网络工程师培训班要多少钱
  • 手机网站域名解析购物网站 服务器 带宽 多大
  • 优秀设计网站大全南京建设局的网站首页
  • 微信扫码即可打开的网站如何做营销型网站设计方针
  • 网站开发好还要空间吗高端装饰公司网站设计
  • 公司网站如何建立福州建设厅网站
  • 中国建设银行车主卡网站网页布局设计框架图表
  • 雅安建设局网站石家庄市网站制作
  • 顺德装修网站建设自己做影视会员网站
  • 怎么看一个网站是不是外包做的邯郸网站制作基本流程
  • 东莞规划局官方网站成都网站建设优化企业排名
  • 怎样制作网站的步骤企业网站开发外包公司
  • 长春市长春网站建设哪家好网站建设分金手指排名一
  • 惠州东莞网站建设融创中国最新消息
  • 如何自己做网站做淘宝客dede单本小说网站源码
  • 学做网站设计需要多少钱网站搜索框代码怎么做
  • 怎么搭建自己的网站卖货代刷网站只做软件吗
  • 网站推广计划wordpress:代码
  • 网站建设幻灯片背景图片素材网络推广怎么做效果好
  • qq建设网站首页江苏公司响应式网站建设报价
  • 个人网站开发流程如何建设企业人力资源网站
  • 上海网站搜索排名优化哪家好vi设计是什么设计
  • 网站建设分期收费网站建设客户怎么寻找
  • 太原网站建设质量推荐代理公司的经营范围