# zp-form **Repository Path**: web-zhangpei/zp-form ## Basic Information - **Project Name**: zp-form - **Description**: 模拟element-ui的登录表单验证;使用lerna发布 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-31 - **Last Updated**: 2021-04-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## demo 的 readme 用法 1. 记录写 demo 的实战经验和注意事项。 ## 快速原型开发 - 构建简单项目 - yarn init -y - vue add element-ui - 启动项目 - vue serve [文件路径] 例如:vue serve src/steps/index.vue ### 组件库开发流程 - 开发 - 单元测试:所有组件状态、对外公布方法 - 打包发布 ## 注意项 1. 使用属性 $arrts 、inhertAttrs 时,style 和 class 不能绑定为 props 2. 数据验证模块 async-validator (element 同款),安装 ## 知识补充 1. while 循环:只要指定条件为 true,循环就可以一直执行代码块。 ## 安装测试依赖 ```bash yarn add jest @vue/test-utils vue-jest babel-jest -D -W ``` ## Jest 的配置 jest.config.js ```js module.exports = { testMatch: ['**/__tests__/**/*.[jt]s?(x)'], moduleFileExtensions: [ 'js', 'json', // 告诉 Jest 处理 `*.vue` 文件 'vue', ], transform: { // 用 `vue-jest` 处理 `*.vue` 文件 '.*\\.(vue)$': 'vue-jest', // 用 `babel-jest` 处理 js '.*\\.(js)$': 'babel-jest', }, } ``` ## Babel 的配置 babel.config.js ```js module.exports = { presets: [['@babel/preset-env']], } ``` ## Babel 的桥接 ```bash yarn add babel-core@bridge -D -W ``` ## 安装 Rollup 以及所需的插件 ```bash yarn add rollup rollup-plugin-terser rollup-plugin-vue@5.1.9 vue-template-compiler -D -W ``` ## Rollup 配置文件 在 button 目录中创建 rollup.config.js ```js import { terser } from 'rollup-plugin-terser' import vue from 'rollup-plugin-vue' module.exports = [ { input: 'index.js', output: [ { file: 'dist/index.js', format: 'es', }, ], plugins: [ vue({ // Dynamically inject css as a