# uniapp-cli-config **Repository Path**: fjxiong/uniapp-cli-config ## Basic Information - **Project Name**: uniapp-cli-config - **Description**: uniapp脚手架方式开发 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2020-11-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # saas-weixin ##包管理 1.使用 yarn 2.不要随意添加依赖 以免影响 #js #####1. 公共方法放在src/utils目录内 统一在index.js内引入 统一 管理 #####2. 添加公共方法必须添加注释 **方法统一注释 使用多行注释** ```js /** * 方法名 * @param{参数类型}参数名 * @param{object} data * @returns {Promise} */ ``` #####3.Vuex 统一存放在/src/store目录 并且区分模块处理 并开启命名空间 1.getters return state中的数据 相当于computed 函数 当state 中数据变化时 从中获取的数据也会及时作出响应变化 2.mutations 不允许存在异步方法 主要用作修改state内的值 3.异步处理统一存放在 actions 内 ```js // 模块基本格式 const state = { userInfo: { id: 20 } } const getters = {} const mutations = { // mutation方法 统一大写 GET_INFO:(state, data){ } } const actions = {} export default { namespace: true, // 命名空间开启 state, getters, mutations, actions } /* * 命名空间开启 调用时 * 比如 模块名为 user * this.$store.user.state * this.$store.user.getter * this.$store.commit('user/GET_INFO') * this.$store.dispatch('user/getInfo') */ ``` #### 全局组件 ​ 全局公共组件目录位置 src/components #### 局部组件 ​ 仅在当前模块使用的组件 ​ 在当前模块根目录内创建components文件夹 ### HTML 1.组件上attribute > 3时 必须换行 2.v-for必须绑定key属性, 禁止 v-for 与 v-if同时使用 # css 1. 使用scss预处理器,组件内书写style 加上scoped 避免污染其他组件样式, 或者 在当前样式层外套一层父级class 2. 全局样式统一放在src/style ## Project setup ``` yarn install ``` ### Compiles and hot-reloads for development ``` yarn dev:mp-weixin ``` ### Compiles and minifies for production ``` yarn build:mp-weixin ```