Coder Social home page Coder Social logo

jingdong-app's Introduction

命名规范
  1.JS用驼峰法命名
  2.css中class命名用"-"分隔,ID用"_"
  3.接口中数据用"_"分隔
  4.文件/文件夹命名用"_"
JS使用规范
  使用ECMAScript 2016
pages里的文件结构
  根据tabbar放入对应的文件夹中,三个入口页面文件放入外层
静态文件
  图片小图使用雪碧图
  对应文件的图片都需要新建对应的文件夹存放图片
代码管理
  使用Git,上传代码时请不要上传app.js和app.json,避免本地请求变为服务器请求

开发中遇到的坑:
  1. JS方面
     不支持DOM操作,需要在开发时能够设置好所有需要的data属性值,然后渲染
     跳转到tabbar页面的时候只能使用wx.switchTab(OBJECT)
     wx.showToast()配置样式单一,且宽度不能自适应

  2. wxml方面
     标签不够语义化
  3. wxss方面
     不支持"a > b > c"双箭头写法,控制台会报错
     背景图属性background-image必须写在标签中,或者使用服务器上的图片
     使用display:flex布局方式,容器大小会随内容大小变化,所以,最好给容器设置宽度
     标注图标注的大小再设置时是原大小的2倍,比如图上标注10*10,css这边写20rpx*20rpx
  4. 其它方面
     json文件是配置window窗口的,但是此时可以省略window属性,如果加window则没有效果,也不会报错

项目中使用过的API:
  1.ES6相关
    对象解构 {} = {}
    箭头函数 =>
    块级变量let、const
    模板字符串${...}
    数组扩展let c = [...a,...b]

  2.微信相关
    WXML
      组件:view、text、image、icon、swiper、progress、navigator、button、input
      template模板
      列表渲染:wx:for="" wx:key=""
      条件渲染:wx:if="" elif="" else

    WXSS
      flex布局
      rpx自适应宽度

    JS相关封装
      动态设置数据:setData()
      发送接口请求:wx.request(OBJECT)
      页面链接:wx.navigateTo()、wx.navigateBack()
      页面弹框反馈:wx.showToast(OBJECT)、wx.showModal(OBJECT)
      本地存储: wx.setStorageSync()、wx.getStorageSync()
      绑定事件:bindtap、onReachBottom

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.