Giter Club home page Giter Club logo

fr_uni_app's Introduction

UNIAPP 自带的原生导航尽管流畅度非常好,但是在具体项目中有的时候需要动态设置以及特殊样式的 底部菜单 这个时候就需要自己去写一个自定义的底部tabbar

1、比如需要特殊的图标 多出来一部分的 多出一部分的图标

2、根据登陆帐号的身份加载不同的tabbar 根据登陆帐号的身份加载不同的tabbar

动图预览

预览

解决方案
  • 将整个首屏4个页面作为组件加载进来 如 入口 index.vue
  • 将 自定义tabbar 写到 index.vue 中 或将其封装为组件 加载进来
  • 使用vuex 统一管理数据
  • 使用小程序自定义组件去解析HTML代码 (UNI的wxParse 看着麻烦 直接撸小程序自定义组件)
引入组件(页面)

引入组件(页面) 渲染首页数据

底部tabbar的切换及数据来源

只要控制 store中的 底部菜单数据 即可。页面中动态渲染

export default {
	state:{
		footer_nav:[
			{
				name:'首页',
				name_code:'home',
				icon:'/static/footer_icon/a2.png',
				select_icon:'/static/footer_icon/a1.png'
			},
			{
				name:'发布',
				name_code:'publish',
				icon:'/static/footer_icon/f2.png',
				select_icon:'/static/footer_icon/f1.png'
			},
			{
				name:'我的',
				name_code:'my',
				icon:'/static/footer_icon/d1.png',
				select_icon:'/static/footer_icon/d2.png'
			},
			
		],
		now_page_index:0,
	},
	mutations:{
		change_page(state,index){
			state.now_page_index = index;
		}
	}
}

添加了自己常用的 request请求模块 添加了自己封装的 上传图片的 模块

fr_uni_app's People

Contributors

gek6 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.