文章目录  1. 自定义tabbar效果 2. pages新建tabbar页面 3. tabbar 页面结构 4. tabbar 页面完整代码   
 
 
首先在 pages.json 文件中,新建一个 tabbar 页面 "pages" :  [  { "path" :  "pages/index/tabbar" , "style" :  { "navigationBarTitleText" :  "tabbar页面" , "navigationStyle" :  "custom" } } , ... . . 
] , 
此页面主要是写 tabbar的html样式和布局,引用主页面代码,通过 v-if 控制进行展示 index,search,maim,news,me 一级页面 
 
css 样式文件太多了就不贴出来了 < template> < view> < indexv-if = " PageCur=='index'" > </ index> < searchv-if = " PageCur=='search'" > </ search> < newsv-if = " PageCur=='news'" > </ news> < mev-if = " PageCur=='me'" > </ me> < viewclass = " box" > < viewclass = " cu-bar tabbar bg-white shadow foot" > < viewclass = " action" @click = " NavChange" data-cur = " index" > < viewclass = ' cuIcon-cu-image' > < imagev-if = " PageCur=='index'" src = " ../../static/tabBar/index_cur.png" > </ image> < imagev-if = " PageCur != 'index'" src = " ../../static/tabBar/index.png" > </ image> </ view> < view:class = " PageCur=='index'?'color_main':'text-gray'" > </ view> </ view> < viewclass = " action" @click = " NavChange" data-cur = " search" > < viewclass = ' cuIcon-cu-image' > < viewclass = " cu-tag badge" > </ view> < imagev-if = " PageCur=='search'" src = " ../../static/tabBar/shop_cur.png" > </ image> < imagev-if = " PageCur != 'search'" src = " ../../static/tabBar/shop.png" > </ image> </ view> < view:class = " PageCur=='search'?'color_main':'text-gray'" > </ view> </ view> < view@click = " NavChange" class = " action text-gray add-action" data-cur = " main" > < imageclass = " logo_btn" mode = " widthFix" src = " ../../static/logo.png" > </ image> < view:class = " PageCur=='main'?'color_main':'text-gray'" > </ view> </ view> < viewclass = " action" @click = " NavChange" data-cur = " news" > < viewclass = ' cuIcon-cu-image' > < viewclass = " cu-tag badge" > </ view> < imagev-if = " PageCur=='news'" src = " ../../static/tabBar/order_cur.png" > </ image> < imagev-if = " PageCur != 'news'" src = " ../../static/tabBar/order.png" > </ image> </ view> < view:class = " PageCur=='news'?'color_main':'text-gray'" > </ view> </ view> < viewclass = " action" @click = " NavChange" data-cur = " me" > < viewclass = ' cuIcon-cu-image' > < imagev-if = " PageCur=='me'" src = " ../../static/tabBar/me_cur.png" > </ image> < imagev-if = " PageCur != 'me'" src = " ../../static/tabBar/me.png" > </ image> </ view> < view:class = " PageCur=='me'?'color_main':'text-gray'" > </ view> </ view> </ view> </ view> </ view> </ template> < script> import  index from  "./index.vue" ; 	import  search from  "./search.vue" ; 	import  main from  "./main.vue" ; 	import  news from  "./news.vue" ; 	import  me from  "./me.vue" ; 	export  default  { components :  { index, search, main, news, me} , data ( )  { return  { PageCur :  'index' , message :  '99+' , duration : 1 } ; } , methods :  { NavChange :  function ( e )  { this . PageCur =  e. currentTarget. dataset. cur; } , } } 
</ script> < stylelang = " scss" > // 省略
 </ style>