Coder Social home page Coder Social logo

aismileboy / vue3-h5-tmp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhoukaiyue/vue3-h5-tmp

0.0 0.0 0.0 253 KB

vue3-h5-tmp 基于 Vue3.x setup + TypeScript + Vite + Pinia + Vant3 + sass + tailwindcss + Rem 布局适配 + axios(封装)+ Eslint + Prettier 等流行技术栈构建移动端模板脚手架,开箱即用。

JavaScript 4.17% TypeScript 59.94% CSS 1.16% HTML 1.36% Batchfile 0.65% Vue 30.21% SCSS 2.51%

vue3-h5-tmp's Introduction

简介

vue3-h5-tmp 基于 Vue3.x setup + TypeScript + Vite + Pinia + Vant3 + sass + tailwindcss + Rem 布局适配 + axios(封装)+ Eslint + Prettier + dayjs 等流行技术栈构建移动端模板脚手架,开箱即用。

技术规范

环境要求

  • node >14
  • pnpm >=7
  • 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致)。

编辑器以及对应扩展

  • Visual Studio v69+
  • Vetur v0.35.0+
  • Eslint v2.2.6+
  • Prettier - Code formatter v9.5.0+
  • Tailwind CSS IntelliSense v0.9.1+

快速开发

#通过 npm 安装 pnpm (如果本地已安装pnpm,请忽略)
npm install -g pnpm
#安装项目依赖
pnpm install
#开发环境启动
pnpm start
#打包 test 环境代码
pnpm build:test
#打包生产环境代码
pnpm build or pnpm build:prod
#执行 js 类型检查
pnpm lint:fix
#执行 prettier 批量格式化代码
pnpm lint:prettier
#执行 ts 语法错误检查
pnpm lint:type

##注:详细请阅读package.json 以及对应的环境配置文件(即.env 文件)!
同时在项目根目录下包含一个 run.bat,该文件会列出所有 package.json 中 script 块里面的所有命令,
通过双击该文件,你可以在命令行中输入相应的序号并按 Enter 键,程序将运行你选择的脚本。

开发基础规范

如果设计稿的尺寸不是 750,而是 375 或其他大小,请在 .postcssrc.js 中及时调整 rootValue。

  • 🚀 重要、复杂逻辑一定要写注释;
  • 🚀 代码规范按照 eslint 的规则来,做到 no waring 和 no error;
  • 🚀 项目业务开发,优先使用 vue 全家桶技术栈开发项目,预编译使用 sass;
  • 🚀 操作成功或失败后要有提示,比如新增成功、新增失败运行时间长的任务(计算量大、请求后台接口),要有 loadding 效果;
  • 🚀 vue 单文件组件代码规范,html、script、style 的位置顺序 html > script > style;
  • 🚀 公共的状态才放到 store;
  • 🚀 代码尽量往纵向发展,一行不要太长;
  • 🚀 不要在钩子函数中写大量业务代码;
  • 🚀 异步使用 aysnc await 语法;
  • 🚀 不是常用的方法不要全局挂载;
  • 🚀 文件命名如果是多单词则采用驼峰命名或者烤肉串大小写,尽量简洁明了;

基础组件名。 【注:src/resources/components 目录。】

基础组件文件命名应该以 base 为前缀命名,以示其唯一性,并且以横线连接。

例子:
src
└─ resources
   └─ components
      └─ base-button
         ├─ index.vue      //源码
         └─ README.md      //组件使用说明文档

业务组件名。 【注:src/views/components 目录。】

业务组件文件命名应该以 the 为前缀命名,以示其唯一性,并且以横线连接。

例子:
src
└─ views
   └─ components
      └─ the-button
         ├─ index.vue      //源码
         └─ README.md      //组件使用说明文档

路由文件创建与命名。 【注:src/config/router 目录。】

为了方便维护与开发,建议路由文件命名与对应的页面文件命名保持一致,尽量简洁明了。

例子:
src
└─ config
   └─ router
      ├─ dev.ts
      ├─ errpage.ts
      └─ index.ts

接口文件创建与命名。 【注:src/config/apis 目录。】

为了方便维护与开发,建议接口文件命名与对应的页面文件命名保持一致,尽量简洁明了。

例子:
src
└─ config
   └─ apis
      └─ dev

状态切片文件创建与命名。 【注:src/config/store 目录。】

为了方便维护与开发,建议以当前对应模块或者功能命名文件夹,采用驼峰命名或者烤肉串大小写,尽量简洁明了。

例子:
src
└─ config
   └─ store
      └─ dev

图片资源。 【注:src/assets/img 目录。】

建议图片文件夹命名与对应的页面文件命名保持一致,公共图片资源放置到 src/assets/img/base 目录下即可。

例子:
src
└─ assets
   └─ img
      └─ base

git 版本规范

分支管理

一般项目分主分支(master)和其他分支。 当有团队成员要开发新功能(Feather)或改 BUG(Fix) 时,就从 master 分支开一个新的分支。

Commit 规范

  • feat 新增功能
  • fix 修复 bug
  • docs 文档变更
  • style 代码格式(不影响功能,例如空格、分号等格式修正)
  • refactor 代码重构
  • perf 改善性能
  • test 测试
  • build 变更项目构建或外部依赖(例如 scopes: webpack、gulp、npm 等)
  • ci 更改持续集成软件的配置文件和 package 中的 scripts 命令,例如 scopes: Travis, Circle 等
  • chore 变更构建流程或辅助工具
  • revert 代码回退

Tag 版本号

版本号以 v 开头,根据当前仓库的 tag 编号进行累加,如:v1.10.45。

项目目录说明

vue3-h5-tmp
├─ .env.development                      // 开发环境配置文件
├─ .env.production                       // 生产环境配置文件
├─ .env.test                             // 测试环境配置文件
├─ .eslintignore                         // ESLint 忽略文件配置
├─ .eslintrc-auto-import.json            // ESLint 自动导入配置
├─ .eslintrc.cjs                         // ESLint 配置文件
├─ .npmrc                                // NPM 配置文件
├─ .postcssrc.js                         // PostCSS 配置文件
├─ .prettierrc.js                        // Prettier 配置文件
├─ .vscode                               // VSCode 编辑器配置文件夹
├─ env.d.ts                              // TypeScript 环境变量类型声明文件
├─ index.html                            // 项目入口 HTML 文件
├─ package.json                          // 项目配置文件
├─ pnpm-lock.yaml                        // pnpm 包管理锁定文件
├─ public                                // 静态资源目录
│  └─ static                             // 静态文件目录
├─ README.md                             // 项目说明文档
├─ run.bat                               // Windows 平台下运行脚本文件
├─ src                                   // 源代码目录
│  ├─ App.vue                            // 应用主组件
│  ├─ assets                             // 资源文件夹
│  ├─ config                             // 配置文件夹
│  │  ├─ apis                            // API 接口配置
│  │  ├─ router                          // 路由配置
│  │  └─ store                           // Vuex 状态管理配置
│  ├─ layout                             // 布局组件
│  ├─ main.ts                            // 项目入口文件
│  ├─ packages                           // 包目录
│  │  ├─ request                         // 网络请求相关
│  │  ├─ router                          // 路由相关
│  │  └─ vConsole                        // 移动端调试工具配置
│  ├─ resources                          // 资源文件夹
│  │  ├─ components                      // 公共组件
│  │  └─ plugin                          // 插件配置
│  ├─ types                              // 类型定义文件夹
│  ├─ utils                              // 工具函数
│  ├─ views                              // 视图组件
│  └─ vue.d.ts                           // Vue 类型声明文件
├─ tailwind.config.js                    // Tailwind CSS 配置文件
├─ tsconfig.config.json                  // TypeScript 配置文件
├─ tsconfig.json                         // TypeScript 编译配置文件
└─ vite.config.ts                        // Vite 构建工具配置文件


vue3-h5-tmp's People

Contributors

zhoukaiyue avatar

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.