mpvue小程序tabBar怎么设置呢,有具体描述,请教下哈

贴出mpvue-quickstart项目创建初始代码:
src/app.json:

{
    "pages": [
        "pages/index/main",
        "pages/logs/main",
        "pages/counter/main"
    ],
    "window": {
        "backgroundTextStyle": "light",
        "navigationBarBackgroundColor": "#fff",
        "navigationBarTitleText": "WeChat",
        "navigationBarTextStyle": "black"
    }
}

src/main.js

import Vue from 'vue'
import App from './App'

import  '../static/weui/weui.css'

Vue.config.productionTip = false
App.mpType = 'app'

const app = new Vue(App)
app.$mount()

请问怎么设置tabBar呢?

"tabBar": {
      "color": "#999",
      "selectedColor": "#1aad16",
      "backgroundColor": "#fff",
      "borderStyle": "#fff",
      "list": [{
        "pagePath": "pages/counter/main",
        "text": "发现1"
      }, {
        "pagePath": "pages/index/main",
        "text": "主页"
      }]
    }
阅读 4k
1 个回答

src/main.js

export default {
  // 这个字段设置路由、title、tabbar
  config: {
    // 页面前带有 ^ 符号的,会被编译成首页,其他页面可以选填,我们会自动把 webpack entry 里面的入口页面加进去
    // eslint检测字符串必须用单引号
    "pages": [
      "^pages/index/main",
      "pages/tabbar/main"
    ],
    "window": {
      "backgroundTextStyle": "light",
      "navigationBarBackgroundColor": "#fff",
      "navigationBarTitleText": "WeChat",
      "navigationBarTextStyle": "black"
    },
    "tabBar": {
      "color": "#999",
      "selectedColor": "#1aad16",
      "backgroundColor": "#fff",
      "borderStyle": "#fff",
      "list": [{
        "pagePath": "pages/index/main",
        "text": "发现1"
      }, {
        "pagePath": "pages/tabbar/main",
        "text": "主页"
      }]
    }
  }
}

src/app.json

{
    "pages": [
        "pages/index/main",
        "pages/logs/main",
        "pages/counter/main",
        "pages/tabbar/main"
    ],
    "window": {
        "backgroundTextStyle": "light",
        "navigationBarBackgroundColor": "#fff",
        "navigationBarTitleText": "WeChat",
        "navigationBarTextStyle": "black"
    },
    "tabBar": {
      "color": "#999",
      "selectedColor": "#1aad16",
      "backgroundColor": "#fff",
      "borderStyle": "#fff",
      "list": [{
        "pagePath": "pages/index/main",
        "text": "发现1"
      }, {
        "pagePath": "pages/tabbar/main",
        "text": "主页"
      }]
    }
}

真是不懂,后面我把main.js中export default {}屏蔽了,tabBar也正常了。。。。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进