帖子
帖子
用户
博客
课程
显示全部楼层
41
帖子
1
勋章
238
Y币

[superwebview] 首页使用json文件 安卓无法监听返回按键

[复制链接]
发表于 2021-3-26 10:39:44
config.xml 定义入口为 app.json文件
app.json如下:
{
    "name": "root",
    "url":"widget://index.html",
    "hideNavigationBar": true,
    "navigationBar": {
      "height": 1,
      "background": "#fff",
      "color": "#fff",
      "hideBackButton": true
    },
    "tabBar": {
      "height": 60,
      "scrollEnabled": true,
      "background": "#fff",
      "shadow": "#f1f1f1",
      "color": "#5e5e5e",
      "selectedColor": "#39baff",
      "fontSize": 12,
      "textOffset": 8,
      "animated": true,
      "preload": 0,
      "frames": [{
        "name": "face_login",
        "url": "html/face_login.html",
        "title": "首页"
      }, {
        "name": "eqpt_list_frame",
        "url": "html/eqpt_list_frame.html",
        "title": "设备"
      }, {
        "name": "eqpt_face_list",
        "url": "html/eqpt_face_list.html",
        "title": "人员"
      },{
        "name": "my_frame",
        "url": "html/my_frame.html",
        "title": "我的"
      }],
      "list": [{
        "iconPath": "image/tabbar/index.png",
        "selectedIconPath": "image/tabbar/index-fill.png",
        "text": "首页"
      }, {
        "iconPath": "image/tabbar/eqpt.png",
        "selectedIconPath": "image/tabbar/eqpt-fill.png",
        "text": "设备"
      }, {
        "iconPath": "image/tabbar/emp.png",
        "selectedIconPath": "image/tabbar/emp-fill.png",
        "text": "人员"
      },{
        "iconPath": "image/tabbar/my.png",
        "selectedIconPath": "image/tabbar/my-fill.png",
        "text": "人员"
      }]
    }
  }
  index.html中监听安卓返回键无效
41
帖子
1
勋章
238
Y币
设置了,同样无效 config.xml指向 index.html
index.html代码如下:
apiready = function () {
    api.setStatusBarStyle({
        style: 'dark'
    });
    api.addEventListener({
        name:"keyback"
    },function () {
      console.log("keyback")
    })
    DbUtil.initDB();
    smartUpdate();
      api.openTabLayout({
          "name": "tab",
          "hideNavigationBar": true,
          "navigationBar": {
              "height": 1,
              "background": "#fff",
              "color": "#fff",
              "hideBackButton": true
          },
          "tabBar": {
              "height": 60,
              "scrollEnabled": true,
              "background": "#fff",
              "shadow": "#f1f1f1",
              "color": "#5e5e5e",
              "selectedColor": "#39baff",
              "fontSize": 12,
              "textOffset": 8,
              "animated": true,
              "preload": 0,
              "frames": [{
                  "name": "face_login",
                  "url": "html/face_login.html",
                  "title": "首页"
              }, {
                  "name": "eqpt_list_frame",
                  "url": "html/eqpt_list_frame.html",
                  "title": "设备"
              }, {
                  "name": "eqpt_face_list",
                  "url": "html/eqpt_face_list.html",
                  "title": "人员"
              },{
                  "name": "my_frame",
                  "url": "html/my_frame.html",
                  "title": "我的"
              }],
              "list": [{
                  "iconPath": "image/tabbar/index.png",
                  "selectedIconPath": "image/tabbar/index-fill.png",
                  "text": "首页"
              }, {
                  "iconPath": "image/tabbar/eqpt.png",
                  "selectedIconPath": "image/tabbar/eqpt-fill.png",
                  "text": "设备"
              }, {
                  "iconPath": "image/tabbar/emp.png",
                  "selectedIconPath": "image/tabbar/emp-fill.png",
                  "text": "人员"
              },{
                  "iconPath": "image/tabbar/my.png",
                  "selectedIconPath": "image/tabbar/my-fill.png",
                  "text": "人员"
              }]
          }
      })
};
41
帖子
1
勋章
238
Y币
机型 小米10,Android11系统
41
帖子
1
勋章
238
Y币
代码附件已发
widget.zip 下载附件
2021-3-26 11:18上传2.06 MB下载次数: 1349
41
帖子
1
勋章
238
Y币
请问有人来解决吗 好像是使用了AVM的原因,增加了pages目录文件后,一系列的监听就失效了
380
帖子
4
勋章
6
Y币
编译自定义loader调试
41
帖子
1
勋章
238
Y币
这个不是模块啊,就是个api 其他的模块本来在其他APP上都使用了 正常的
380
帖子
4
勋章
6
Y币
kx1981 发表于 2021-3-26 11:33
这个不是模块啊,就是个api 其他的模块本来在其他APP上都使用了 正常的

编译自定义loader调试
您需要登录后才可以回帖 登录

本版积分规则