### 前端(Vue.js)命名规范 #### 变量命名 - 使用驼峰命名法(camelCase)来命名变量,首字母小写。 - 示例:`userInfo`, `selectedItem`. #### 函数命名 - 同样使用驼峰命名法,以动词开头描述函数的操作。 - 示例:`getUserData()`, `updateUserProfile()`. #### 组件命名 - 使用帕斯卡命名法(PascalCase)来命名组件,每个单词的首字母都大写。 - 示例:`UserProfile`, `ProductList`. #### 文件命名 - 使用帕斯卡命名法来命名 Vue 组件文件,同时在文件名中体现出组件的用途。 - 示例:`UserProfile.vue`, `ProductList.vue`. #### 常量命名 - 常量全部大写,多个单词间使用下划线分隔。 - 示例:`MAX_ITEMS`, `API_ENDPOINTS`. #### CSS 类名 - 使用连字符(kebab-case)来命名类名,保持一致。 - 示例:`user-profile`, `product-card`. #### 路由命名和地址规范 - 使用小写字母和连字符(kebab-case)来命名路由地址。 - 示例:`/user-profile`. --- ### 运行命令: ```bash npm install -g pnpm # 下载 pnpm pnpm install # 下载配置项 pnpm dev # 运行 pnpm build # 打包 ```