爱意满满的作品展示区。
Marstin

自动生成 Vue+ElementUI 增删改查代码插件

  •  
  •   Marstin ·
    Marstin · Sep 4, 2020 · 2545 views
    This topic created in 2102 days ago, the information mentioned may be changed or developed.

    webpack 插件,目的是为了在简单的 CURD 动作中减少Ctrl+cCtrl+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 replies    2020-09-04 10:56:54 +08:00
    NikoXu
        1
    NikoXu  
       Sep 4, 2020
    能定义模版吗
    Marstin
        2
    Marstin  
    OP
       Sep 4, 2020
    @NikoXu 不能
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2890 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 03:38 · PVG 11:38 · LAX 20:38 · JFK 23:38
    ♥ Do have faith in what you're doing.