Ray CommonCharts

小程序开发相关产品技术讨论,包括面板、智能小程序、React Native、Ray跨端框架、Panel SDK、微信小程序、小程序开发工具(IDE)及其他开发技术相关等话题


Post Reply
18559697016
Posts: 53

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

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

Tags:
muhai
Posts: 63

Re: Ray CommonCharts

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

Code: Select all

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

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

Code: Select all

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

  }
})
18559697016
Posts: 53

Re: Ray CommonCharts

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

muhai
Posts: 63

Re: Ray CommonCharts

18559697016 2024年 Aug 28日 17:20

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

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

Code: Select all

import { getSystemInfo } from '@ray-js/ray'
18559697016
Posts: 53

Re: Ray CommonCharts

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

muhai
Posts: 63

Re: Ray CommonCharts

18559697016 2024年 Aug 29日 09:08

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

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

Code: Select all

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

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