vue3lowcode

Vue3 低代码表单 Element-Plus
1,054
Install
npm install vue3lowcode
Latest Version:4.1.3
Older releases:3
Last Updated:Jul 23, 2024
Links: npm
Maintainer: qiuzxian

更新版本时候 package.json 用 package2 ,开发时候用 package1

vue3lowcode 低代码

element-plus + vue3

安装依赖

npm install --registry=https://registry.npmmirror.com

开发调试

npm run serve

生产打包

npm run build

表单设计器 + 表单渲染器打包

npm run lib

更新到 npm 上 npm set registry https://registry.npmjs.org/ npm publish 更新完之后 npm config set registry http://registry.npm.taobao.org/

首次需要登录 npm npm adduser 输入 npm 账号密码

退出当前账号 npm logout

表单渲染器打包

npm run lib-render

浏览器兼容性

Chrome(及同内核的浏览器如QQ浏览器、360浏览器等等),Firefox,Safari


跟 Vue 3.x 项目集成


1. 安装包
npm i vue3lowcode

或

yarn add vue3lowcode

2. 引入并全局注册 vue3lowcode 组件
import { createApp } from 'vue'
import App from './App.vue'

import ElementPlus from 'element-plus'  //引入element-plus库
import 'element-plus/dist/index.css'  //引入element-plus样式

import VForm3 from 'vue3lowcode'  //引入VForm 3库
import 'vue3lowcode/dist/designer.style.css'  //引入VForm3样式

const app = createApp(App)
app.use(ElementPlus)  //全局注册element-plus
app.use(VForm3)  //全局注册VForm 3(同时注册了v-form-designer和v-form-render组件)

app.mount('#app')

3. 在 Vue 3.x 模板中使用表单设计器组件
<template>
  <v-form-designer ref="vfdRef"></v-form-designer>
</template>

<script setup>
  const vfdRef = ref(null);
</script>

<style lang="scss">
  body {
    margin: 0; /* 如果页面出现垂直滚动条,则加入此行CSS以消除之 */
  }
</style>

4. 在 Vue 3.x 模板中使用表单渲染器组件
<template>
  <div>
    <v-form-render
      :form-json="formJson"
      :form-data="formData"
      :option-data="optionData"
      ref="vFormRef"
    >
    </v-form-render>
    <el-button type="primary" @click="submitForm">Submit</el-button>
  </div>
</template>
<script setup>
  import { ref, reactive } from "vue";
  import { ElMessage } from "element-plus";

  const formJson = reactive({
    widgetList: [],
    formConfig: {
      modelName: "formData",
      refName: "vForm",
      rulesName: "rules",
      labelWidth: 80,
      labelPosition: "left",
      size: "",
      labelAlign: "label-left-align",
      cssCode: "",
      customClass: "",
      functions: "",
      layoutType: "PC",
      jsonVersion: 3,
      onFormCreated: "",
      onFormMounted: "",
      onFormDataChange: "",
    },
  });
  const formData = reactive({});
  const optionData = reactive({});
  const vFormRef = ref(null);

  const submitForm = () => {
    vFormRef.value
      .getFormData()
      .then((formData) => {
        console.log(formData);
      })
      .catch((error) => {
        ElMessage.error(error);
      });
  };
</script>

Related Packages

irdd

vue组件深度封装和方法库

1,605 2
element-ui-el-table-draggable

Make 'el-table' of 'element UI' sortable.

88,520 110
nuxt-element-ui

A Nuxt module for Element UI.

9,327
zfs-component

basic components of zfs

6,473
@fsscxh/zfs-component

basic components of zfs

3,796

Version History

Version Released Vue License
4.1.3
4.1.2
4.1.1
4.1.0
4.0.9