电脑端clickable点击测试没效果,换到了手机端就行
发布于 6 年前 作者 yyu 15287 次浏览 来自 问答

具体情况是这样的:当在电脑端测试时,底下的console不会有任何的反馈,但当转移到手机上测试时,就可以在电脑端的console实时收到反馈结果

//index.wxml

//index.js Page({ data: { log: 0, lat: 0, controls: [] }, /**

  • 生命周期函数–页面加载 */ onLoad: function () { var that = this; wx.getLocation({ success: function (res) { var longitude = res.longitude var latitude = res.latitude that.setData({ log: longitude, lat: latitude }) }, })
wx.getSystemInfo({
  success: function(res) {
   var windowWidth = res.windowWidth;
   var windowHeight = res.windowHeight;
    that.setData({
      controls: [
        //扫码按钮
        {
          id: 1,
          //控件按钮的背景图片
          iconPath: '/images/button_1.png',
          //控件的相对页面的位置
          position: {
            width: 100,    //控件的相对长度
            height: 40,
            left: windowWidth / 2 - 50,     
            top: windowHeight - 60          //控件距离订端的距离
          }, 
          //是否可点击
          clickable: true
        },

        {
          //按钮
          id:2,
          iconPath:'/images/img_1.png',
          position :{
            width : 80,
            height : 80,
            left : 5,
            top : windowHeight - 80
          },
          //是否可点击
          clickable : true
        },

        {
          //充值按钮
          id:4,
          iconPath:'/images/pay.png',
          position:{
            width : 60,
            height : 35,
            left: windowWidth - 45,
            top : windowHeight - 100
          },
          //是否可点击
          clickable : true
        },
        {
          //报修
          id : 6,
          iconPath : '/images/warn.png',
          position : {
            width : 38,
            height : 38,
            left: windowWidth - 35,
            top : windowHeight - 50
          },
          //是否可点击
          clickable : true
        },
      ]
    })
  },
})

},

/**

  • 控件被点击事件 */ controltap:function(e){ var cid = e.controlId; console.log(cid) }, })
2 回复

没有很明白需要反馈的问题,请具体描述一下

刚刚问到了,这个好像是工具的一个小BUG,正常来说,给一张图片设置clickable为true后,点击图片后就会反馈,不管是warning还是数值,至少在console上回打印东西,但是,如果把系统的字体设置为125%后,再去测试程序,发现console上什么也没有

您可以把我的代码分别放在开发者工具上,分别将字将图片上的设置为100%,125%运行对比一下后您应该就能明白,希望能修复,因为这个东西坑了我好几天,让我总是以为w我的程序有错,一直不敢往下进行

回到顶部