小程序自定义导航栏

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


Post Reply
mark
Posts: 7

1.用ray写法,global.config.ts里配置
usingComponents: {
'nav-bar': './pages/Nav/index',
}
pages/Nav/index.json配置了
{
"component": true
}
编译会报错.想在小程序页面全局应用的自定义导航栏应该怎么设置呢?

2.global.config.ts下window的custom: true作用是什么?


Tags:
lshinylee
Posts: 331

Re: 小程序自定义导航栏

custom: true 的作用是不使用系统的默认导航栏,使用业务自定义的。

如果在 Ray 里面希望自定义业务导航栏可以参考这个基础的 SDM 模板,

  1. 页面配置使用自定义导航栏:https://github.com/Tuya-Community/tuya- ... nfig.ts#L6
  2. 页面使用 SmartUI 的 NavBar 进行渲染:https://github.com/Tuya-Community/tuya- ... ex.tsx#L12

:D :D :D

mark
Posts: 7

Re: 小程序自定义导航栏

在global.config.ts custom: true不生效,只有在页面config.ts或者global.config.ts配置了navigationStyle: 'custom'才行

使用smartUI的NavBar封装了一个自定义导航栏,怎么结合global.config.ts里的usingComponents呢?

xiaoqi
Posts: 49

Re: 小程序自定义导航栏

不需要用usingComponents 直接在需要用到这个组件的地方引入即可
import { NavBar } from '@ray-js/smart-ui'

xiaoqi
Posts: 49

Re: 小程序自定义导航栏

NavBar 使用 SmartUI之后就完全脱离小程序的头部配置功能了 都需要你自己去根据SmartUI NavBar 修改和实现

Post Reply