-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RN开发规范 #61
Labels
Comments
Repository owner
locked and limited conversation to collaborators
Jun 13, 2018
Repository owner
unlocked this conversation
Jun 13, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created by wuyunqiang
驼峰式:第二个单词首字母大写
大驼峰式:每个单词的首字母都是大写的
默认是驼峰式
一:文件
1:文件夹 全部小写字母
例如:page,component,assets
2:js文件 大驼峰式规范
页面Page结尾
工具Util结尾
原生组件Android||IOS结尾 最后统一导出
例如:
HomePage
HttpUtil
WebAndroid||WebIOS=>统一在Web.js里面导出
二:变量
禁止使用var
实例变量let
实例常量const
静态属性static
1:全局属性(项目启动即引用) 全部大写
例如:
global.WIDTH = deviceWidth;
2:静态属性(局部页面使用,使用才引用) 类型+驼峰式命名
例如:
Array a aNameList
string s sName
Boolean b bVisible
Float f fMoney
Function fn fnMethod
Int i iAge
Object o oType
Regexp re rePattern(正则表达式)
可变类型 v vObj
例如:
3:类变量(需要更新UI 不需要更新UI) 类型+驼峰式命名
4:实例变量 _{驼峰式组件名字}
三:方法
1:静态方法 大驼峰式
2:功能型
3:动作型 xxxxAction
4:回调型
1:父子组件间回调 onXXX
2:页面回调 XXXCallBack
2.1:
A navigate B
2.2:
A通过回调监听B页面的广播
四:组件化
禁止在render方法里面写太多代码
纯组件:独立于事件,业务,每个项目都可以复用。
业务组件:和本项目相关联
页面:都多个业务组件组合
The text was updated successfully, but these errors were encountered: