vue測試模板與jsonSchema自動生成elment組件


背景:

新功能頁面設計與布局、動態生成UI組件、拖拽模板生成頁面,然后生成代碼等等,目的都是減少開發成本或復用通用組件。

html:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>vue模板</title>
        <link rel="stylesheet" type="text/css" href="//unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css" />
        <script src="//unpkg.com/vue/dist/vue.js"></script>
        <script src="//unpkg.com/element-ui@2.13.0/lib/index.js"></script>
    </head>
    <body>
        <div id="app">
            <el-row>
                <el-button>默認按鈕</el-button>
                <el-button type="primary">主要按鈕</el-button>
                <el-button type="success">成功按鈕</el-button>
                <el-button type="info">信息按鈕</el-button>
                <el-button type="warning">警告按鈕</el-button>
                <el-button type="danger">危險按鈕</el-button>
            </el-row>

            <el-row>
                <el-button plain>朴素按鈕</el-button>
                <el-button type="primary" plain>主要按鈕</el-button>
                <el-button type="success" plain>成功按鈕</el-button>
                <el-button type="info" plain>信息按鈕</el-button>
                <el-button type="warning" plain>警告按鈕</el-button>
                <el-button type="danger" plain>危險按鈕</el-button>
            </el-row>

            <el-row>
                <el-button round>圓角按鈕</el-button>
                <el-button type="primary" round>主要按鈕</el-button>
                <el-button type="success" round>成功按鈕</el-button>
                <el-button type="info" round>信息按鈕</el-button>
                <el-button type="warning" round>警告按鈕</el-button>
                <el-button type="danger" round>危險按鈕</el-button>
            </el-row>

            <el-row>
                <el-button icon="el-icon-search" circle></el-button>
                <el-button type="primary" icon="el-icon-edit" circle></el-button>
                <el-button type="success" icon="el-icon-check" circle></el-button>
                <el-button type="info" icon="el-icon-message" circle></el-button>
                <el-button type="warning" icon="el-icon-star-off" circle></el-button>
                <el-button type="danger" icon="el-icon-delete" circle></el-button>
            </el-row>
        </div>
        <script type="text/javascript">
            new Vue().$mount('#app')
            // new Vue({ // 擴展
            //   el: '#app',
            //   router,
            //   store,
            //   template: '<App/>',
            //   components: { App },
            //   render: h => h(App)
            // });
        </script>
    </body>
</html>

通過json生成組件,在gitHub查詢了很多插件:

 

 目的:生成json數據(數據類型和值、UI組件類型與校驗、2者的結合)

參考項目:

https://json-schema.org/

https://github.com/jsonform/jsonform

https://github.com/jdorn/json-editor

https://github.com/yourtion/vue-json-ui-editor (json數據過於簡單只存數據,語義化不好)

https://github.com/YMFE/json-schema-editor-visual (通過UI組件生成json格式的數據,antd)

針對elment組件:

https://github.com/GavinZhuLei/vue-form-making/blob/master/README.zh-CN.md

https://github.com/formschema/elementui

https://github.com/codetrial/element-form-builder/blob/develop/.github/preview.gif

https://github.com/xaboy/form-create

針對antd組件:

https://github.com/NgeKaworu/antd-form-gen

其他:

https://github.com/rjsf-team/react-jsonschema-form

https://github.com/json-schema-form/angular-schema-form

【demo】:

https://codepen.io/share-web/pen/ZEYyqzX?editors=0010

 前端開發在線拖拽生成頁面:

http://lowcode.magicalcoder.com/magicaldrag/index-page.html

其他匯總: https://www.cnblogs.com/camille666/p/drag_blockcomponent_generatepages.html

 -end-


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM