1 Star 1 Fork 0

huiyong.rao / vite-vue2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

一个基于 vue2 的 vite 模板

主要技术栈

注意事项

使用 yarn 进行安装本项目

  • node >= 16

  • 严格遵守项目提交规范(commitlint)

  • 如果使用的是 Windows,则需要关闭行尾转换 git config --global core.autocrlf input

  • 自动生成 svg 组件

    每次新增 svg 图片后,需要重新执行命令 yarn svg 生成 svg 组件,如果项目在运行中可能会出现编译异常,解决方法如下:

    1. 退出服务后,重新执行 yarn dev
    2. 注释 main.ts 文件内 svg 组件的引用(import '@/icons/components';),等编译完成后再次取消注释(推荐该方法

Mock

建议在 mock 接口前统一加上/mock-api 前缀

Svg

svgicon

  1. 使用方式
<svg-icon name="back-top" />

命令

  • 启动本地开发环境(自带热启动)
# install dependencies
$ yarn install

# serve with hot reload at localhost:3000
$ yarn dev

# build for production
$ yarn build

# 自动生成 svg 组件(在plugins/svg-icon中定义组件参数)
$ yarn svg

# eslint检查
$ yarn lint

# eslint修复
$ yarn lint:fix

# stylelint检查
$ yarn stylelint

# stylelint修复
$ yarn stylelint:fix

# prettier检查
$ yarn format

# prettier修复
$ yarn format:fix

# 执行eslint修复、stylelint修复和prettier修复
$ yarn fix

# 启用 git hooks
$ yarn prepare

目录结构

├── .husky                     # husky (git hooks)
├── public                     # 静态资源 (会被直接复制)
│   └── .htaccess              # Apache 服务配置
│   └── robots.txt             # 爬虫规则配置
├── mock                       # 本地mock
├── src                        # 源代码
│   ├── icons                  # 图标
│   ├── router                 # 路由
│   ├── store                  # 状态管理
│   ├── styles                 # 样式
│   ├── types                  # 类型声明
│   ├── utils                  # 插件/方法
│   ├── vites                  # 页面
│   ├── App.vue                # 入口页面
│   ├── main.js                # 入口文件 加载组件 初始化等
│   ├── permission.ts          # 权限管理
├── .editorconfig              # editorconfig 配置
├── .env.xxx                   # 环境变量配置
├── .eslintrc.cjs              # eslint 配置
├── .prettierrc                # prettier 配置
├── .lintstagedrc.js           # lint-staged 配置
├── commitlint.config.cjs      # commitlint 配置
├── stylelint.config.cjs       # stylelint 配置
├── package.json               # package.json 依赖
├── postcss.config.cjs         # postcss 配置
├── tsconfig.json              # typescript 配置
└── vite.config.js             # vite 配置

兼容性

Edge Firefox Chrome Safari
Edge ≥84 Firefox ≥83 Chrome ≥84 Safari ≥14.1

项目部署

  1. 项目使用history 模式,需要进行后端配置(已默认配置 Apache 方案)
MIT License Copyright (c) 2023 huiyong.rao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

使用vue2+vite+mock+ts+eslint进行构建的初始化模板 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/raohuiyong/vite-vue2.git
git@gitee.com:raohuiyong/vite-vue2.git
raohuiyong
vite-vue2
vite-vue2
master

搜索帮助