前端 命名规范

项目命名
      全小写_隔开  my_project_name

    文件命名:小写开头、驼峰命名
      apiUtil.html
      apiUtil.css
      apiUtil.js

    目录命名: 全小写

    css命名规范
      1)1.位置属性(position, top, right, z-index, display, float等)
        2.大小(width, height, padding, margin)
        3.文字系列(font, line-height, letter-spacing, color- text-align等)
        4.背景(background, border等)
        5.其他(animation, transition等)
      2)属性用简写
      3)去除小数点前面0     .8rem
      4)命名全小写
        命名用-隔开  main-title
        新增前缀  is-withdraw
      2)连字符命名 main-title

    js命名规范
      变量:小驼峰          maxCount
      常量:全大写_隔开     MAX_COUNT
      方法:
        小驼峰、
        前缀应当为动词(get/set/is/has/can/load)
        getData()
      类:大驼峰,首字母大写     Person
      私有属性:前缀为_         _name

    图片业务(可选) +(mod_)图片功能类别(必选)+ 图片模块名称(可选) + 图片精度(可选)
      eg:wx_btn_goodList@2x.png
posted @ 2022-02-23 22:36  波吉国王  阅读(72)  评论(0编辑  收藏  举报