命名规范

单位

统一使用rpx,固定尺寸除外(1px边框之类)

点击事件统一使用@tap

页面命名(pages)

一级页面放在pages下,页面需要以文件夹形式定义,命名方式以横线分割

|--pages
|--home
|----index.vue // 主页
|----api.js // api
|------sub-page
|--------index.vue // 二级页面入口
|--------api.js // 二级页面api定义

组件命名规范

组件使用-方式命名,引用组件定义使用大写首字母驼峰命名,

import UniNavBar from "@/components/uni-nav-bar/uni-nav-bar.vue"
export default {
  components: {UniNavBar},
  data() {
    return {
      ColorList: this.ColorList
    };
  }
};

使用组件使用-方式命名

<uni-nav-bar>
  <view>背景</view>
  <view slot="left">left</view>
  <view slot="right">right</view>
</uni-nav-bar>

组件内部emit事件,直接写事件名称,如

emit('click')

外部组件调用,使用handleXXX处理

<component @click="handleClick" />

可能用到的组件

NoticeBar 通告栏

https://ext.dcloud.net.cn/plugin?id=30

mescroll 下拉刷新,上拉加载更多

http://www.mescroll.com/uni.html

关于静默更新

http://ext.dcloud.net.cn/plugin?id=237