APICloud A页面有一个底部导航栏 点击A页面的按钮进入另一个页面B B页面也有一个底部导航栏 从B返回到A页面的时候,怎么显示A的底部导航栏

版权声明:博客知识产权来源命运的信徒,切勿侵权 https://blog.csdn.net/qq_37591637/article/details/89134901

要求说明

1、APICloud A页面有一个底部导航栏TAB_A

2、点击A页面中的某一个部分/按钮可以进入另一个页面B

3、B页面也有一个底部导航栏 TAB_B

4、从B点击按钮返回到A页面的时候,怎么显示A的底部导航栏


涉及的知识点(方子)

底部导航栏、api.openWin({})、api.openFrame({})


解决方案

1、A页面有导航栏TAB_A

在index.html里面引入js文件,这个js文件里面有A页面,实现如下链接文章

https://blog.csdn.net/qq_37591637/article/details/88528136

2、点击A页面进入带有另一个导航栏的B页面

2.0、新建一个nindex.html(一个windows窗口,里面包含底部导航栏的)

2.1、打开方式open.Win({})

  api.openWin({
            name: 'nindex',
            url: './nindex.html',
        });

2.2、nindex.html页面同样引入一个js文件(TAB_B)导航栏,这个js文件里面有B页面 实现如下链接文章

https://blog.csdn.net/qq_37591637/article/details/88528136

2.3、从B页面返回A页面很简单,但是如果返回的A页面带有导航栏的话,就需要如下的代码

在B页面设置一个按钮

<button type="button" class="btn btn-danger" onclick="rcommon()">返回普通用户中心</button>

rcommon的js代码如下

  api.openFrame({
      name: 'A页面名称',
      url: './A页面名称.html',
      rect: {
        x:0,
        y:0,
          w: 'auto',
          h: api.winHeight-70,
      }
});

这样做了以后,A页面的确会有导航栏,但是却是TAB_B导航栏,不是TAB_A导航栏

最后一步操作

在rcommon的js代码里面加入如下代码,关闭当前windows窗口

api.closeWin();

完整的rcommon方法如下

function rcommon(){
api.closeWin();
  api.openFrame({
      name: 'my',
      url: './my.html',
      rect: {
        x:0,
        y:0,
          w: 'auto',
          h: api.winHeight-70,
      }
});
}

猜你喜欢

转载自blog.csdn.net/qq_37591637/article/details/89134901