Skip to content

oceanxy/vue-template-generator-v2

Repository files navigation

vue-template-generator-v2

Project setup

node >= v18, git = latest

拉取项目

cd [项目目录]
git clone [本项目GIT仓库地址]
cd [本项目GIT仓库名称]/src/apps
git clone [子项目仓库地址]
cd ../../..

安装依赖包/启动本地环境/打包/清缓存

使用NPM包管理器:

npm install
#############################################
npm run dev -- --app demo # 本地开发环境
npm run build -- --app demo # 生产环境打包
npm run test -- --app demo # 测试环境打包
npm run stage -- --app demo # 预发布环境打包
#############################################
npm run clean:cache # 清除缓存目录
npm run clean:app-cache -- --app demo # 清除指定子项目缓存

使用yarn包管理器:

yarn install
#############################################
yarn dev --app demo
yarn build --app demo
yarn test --app demo
yarn stage --app demo
#############################################
yarn clean:cache
yarn clean:app-cache --app demo

如要修改本地/生产/测试/预发布的运行/打包参数,请修改 [项目目录]/[本项目GIT仓库名称]/src/apps/[子项目仓库名称]/configs 目录下对应的环境变量文件:

  • .env.development
  • .env.production
  • .env.test
  • .env.stage

注意:

  • 更新代码或修改环境变量之后启动任意一个环境,遇到代码不生效的问题,请先清除本地缓存后再次执行相应命令。
  • 打包好的文件位于 [项目目录]/[本项目GIT仓库名称]/dist/[子项目仓库名称]
  • 执行命令期间报错,请重新安装依赖包(node_modules)。

开发问题排查

搜索栏的重置按钮不会重置各个表单项的值为初始值?

确保 store.state.search 中为该表单项定义了初始值。

开发注意事项

store.currentItem的监听一定要谨慎

多层弹窗时,因本框架对store.currentItem的特殊处理,每层弹窗都会对上一层弹窗的currentItem数据进行缓存。 当新开弹窗时,currentItem数据会更新为新开弹窗(上层弹窗)的对应数据,此时下层弹窗的currentItem数据会被 缓存到currentItem._prevCurrentItem中。此时如果在下层弹窗中有对currentItem的监听(watch),则可能会引 起异常行为以及性能损耗。所以推荐在弹窗的开启和关闭时,手动对该弹窗的currentItem监听进行清除。幸运的是, vue3提供了此API,如要清除监听,调用watch返回的函数即可。

关闭弹窗时,表单未清空

请检查store[location].form[fieldName]中否定义了与表单绑定的字段。默认情况下,关闭弹窗会清空弹窗内的表单, 依赖于ant-design-vueForm组件的useFormAPI返回的resetFields方法。

About

一个简单的后台系统快速开发模版(vue3版本),正在不断完善中...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •