请选择 进入手机版 | 继续访问电脑版
帖子
帖子
用户
博客
课程
显示全部楼层
85
帖子
6
勋章
5746
Y币

[多端开发] 关于openTabLayout的tabBar效果问题

[复制链接]
发表于 2021-9-10 16:43:45
添加了app.json,config设置了app.json入口文件,首页、学习、发现、奖励、我的这五个页面点击底部导航可以正常切换,但是从”首页“里面某个点击事件openWin跳转到”发现“这个页面,底部导航不显示了,有什么好的方法让底部导航也显示呢?



首页home页面:
<template>
    <view class="home">
         <view class="public" @click="tofind()"> <text>点击跳转发现页面</text></view>
    </view>
</template>
<script>
export default {
    name: "home",
    data() {
        return {
        };
    },
    methods: {
            tofind() {
            api.openWin({
                name: 'find',
                url: '../column-find/find.stml',
                pageParam: {
                    navNum: 2,
                    num: 2
                }
            })
            // api.openTabLayout({
            //  name: 'find',
            //  url: '../column-find/find.stml',
            //  hideTabBar: false,
            //  pageParam: {
            //      navNum: 2,
            //      num: 2
            //  },


        },

    }
};
</script>




app.josn文件:

{
  "name": "root",
  "tabBar": {
    "frames": [
      {
        "title": "首页",
        "name": "home",
        "url": "../column-home/home.stml"
      },
      {
        "title": "学习",
        "name": "study",
        "url": "../column-study/study.stml"
      },
      {
        "title": "发现",
        "name": "find",
        "url": "../column-find/find.stml"
      },
      {
        "title": "奖励",
        "name": "reward",
        "url": "../column-reward/reward.stml"
      },
      {
        "title": "我的",
        "name": "user",
        "url": "../column-user/user.stml"
      }
    ],
    "list": [
      {
        "text": "首页",
        "iconPath": "../images/common/sy_wxz.png",
        "selectedIconPath": "../images/common/sy_xz.png"
      },
      {
        "text": "学习",
        "iconPath": "../images/common/xx_wxz@2x.png",
        "selectedIconPath": "../images/common/xx_xz@2x.png"
      },
      {
        "text": "发现",
        "iconPath": "../images/common/fx_wxz.png",
        "selectedIconPath": "../images/common/fx_xz.png"
      },
      {
        "text": "奖励",
        "iconPath": "../images/common/jl_wxz.png",
        "selectedIconPath": "../images/common/jl_xz.png"
      },
      {
        "text": "我的",
        "iconPath": "../images/common/wd_wxz.png",
        "selectedIconPath": "../images/common/wd_xz.png"
      }
    ],

    "textOffset": 6,
    "color": "#999999",
    "selectedColor": "#FF7037",
    "scrollEnabled": false
  }
}




380
帖子
4
勋章
6
Y币
api.setTabBarAttr({
    index: 2
});

调用这个方法设置跳转
85
帖子
6
勋章
5746
Y币
技术支持-F 发表于 2021-9-11 13:41
api.setTabBarAttr({
    index: 2
});

好的,这个方法可以传参数吗,怎么传?
380
帖子
4
勋章
6
Y币
Not Foundcl 发表于 2021-9-13 09:31
好的,这个方法可以传参数吗,怎么传?

不能传参

可以使用api.sendEvent 传参
您需要登录后才可以回帖 登录

本版积分规则