页面
Ray 的一个页面也是一个 React 组件。
// src/pages/index.js
const IndexPage = () => {
return <View>Hello world!</View>;
};
export default IndexPage;
页面配置
假设您的页面文件是 src/pages/index.js,那么这个页面对应的配置文件就是 src/pages/index.config.js。
同 global.config.js 一样,您可以默认导出一个配置,也可以为不同的平台导出不同的配置。
export const web = {
navigationBarTitleText: '个人中心',
backgroundColor: '#f2f4f6',
};
export const tuya = {
navigationBarTitleText: '个人中心',
backgroundColor: '#f2f4f6',
};
export const wechat = {
navigationBarTitleText: '个人中心',
backgroundColor: '#f2f4f6',
};
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
生命周期
对于 class 组件的页面您可以直接在 class 上监听页面的生命周期。
export default class IndexPage extends React.Component {
// 页面组件的 didMount 触发时机是在 onLoad 的时候
componentDidMount() {
console.log