Page 1 of 1

Ray CommonCharts

Posted: 2024年 Aug 28日 15:22
by 18559697016

横屏后, “年月日”那个组件,没有隐藏的话,太不合理了。
点击横屏事件,没有回调的话,不知道何时应该隐藏组件。
或者有没有其他方法,能实现横屏后,可以做一些其他处理?

1711724829088_.pic.jpg
1721724829089_.pic.jpg

Re: Ray CommonCharts

Posted: 2024年 Aug 28日 16:59
by muhai

可以试试supportFullScreen属性,设置为true

Code: Select all

<Charts
  ...
  supportFullScreen={true} // 是否支持全屏展示
/>

代码也可以通过ty.onWindowResize监听一下横竖屏切换,做个宽高适配
横竖屏在系统信息也可以获取到

Code: Select all

ty.getSystemInfo({
  success: res=> {
    // portrait 
    // landscape
    res.deviceOrientation

  }
})

Re: Ray CommonCharts

Posted: 2024年 Aug 28日 17:20
by 18559697016

Ray 开发可以用ty.开头的代码么


Re: Ray CommonCharts

Posted: 2024年 Aug 28日 20:43
by muhai
18559697016 2024年 Aug 28日 17:20

Ray 开发可以用ty.开头的代码么

可以,不过推荐使用@ray-js/ray里的api,例如 ty.getSystemInfo,ray开发要写成

Code: Select all

import { getSystemInfo } from '@ray-js/ray'

Re: Ray CommonCharts

Posted: 2024年 Aug 29日 09:08
by 18559697016

即便这样,不够用的,不知道客户何时,点击了 全屏按钮,也就不知道,何时应该去隐藏组件了 :)


Re: Ray CommonCharts

Posted: 2024年 Aug 29日 09:21
by muhai
18559697016 2024年 Aug 29日 09:08

即便这样,不够用的,不知道客户何时,点击了 全屏按钮,也就不知道,何时应该去隐藏组件了 :)

点击全屏时,这个方法会回调一下, 可以试试,onWindowResize

Code: Select all

import { onWindowResize, getSystemInfo } from '@ray-js/ray';

onWindowResize(() => {
  // 切换了全屏
  getSystemInfo({
    success: res => {
      // 横竖屏
      res.deviceOrientation;
    },
  });
});