自动生成 Vue+ElementUI 增删改查代码插件
資深大佬 : Marstin 1
webpack 插件,目的是为了在简单的 CURD 动作中减少Ctrl+c和 Ctrl+v。
webpack配置文件 或 Vue-Cli配置文件中配置一下下,即可生成对应目录中的代码。可配置数据 Model,增删改查四项功能搭配,请求配置与自定义等
npm install curd-vue-element-plugin -D
const CurdVueElementPlugin = require('curd-vue-element-plugin') plugins: [ new CurdVueElementPlugin({ baseDir: './src', options: [{ name: 'project', service: ['list', 'add', 'update', 'del'], component: { primaryKey: 'id', model: [{ name: 'name', text: '姓名', isSearch: true }, { name: 'sex', text: '性别' }, { name: 'telephone', text: '手机号码', isSearch: true }, { name: 'email', text: '邮箱' }, { name: 'address', text: '地址', isEdit: false }] } }, { //……options }, { //……options }] }) ]
详见 curd-vue-element-plugin
大佬有話說 (2)