Skip to content

Source Integration ​

This guide explains how to integrate the designer source code into your project.

Getting the Source Code ​

bash
git clone https://github.com/xaboy/form-create-designer.git
cd form-create-designer
npm install

Version Selection:

Choose the corresponding branch and source directory based on your project's tech stack:

Project TypeBranchSource PathUI Framework Dependency
Vue 2masterform-create-designer/srcelement-ui
Vue 3nextform-create-designer/packages/element-ui/srcelement-plus
Vue 3nextform-create-designer/packages/ant-design-vue/srcant-design-vue
Vue 3nextform-create-designer/packages/vant/srcvant

Source Code Structure ​

Core directory structure:

src/
β”œβ”€β”€ components/    # Designer components
β”œβ”€β”€ config/       # Configuration items
β”œβ”€β”€ utils/        # Utility functions
β”œβ”€β”€ index.js      # Main entry file

Local Integration Steps ​

  1. Copy the form-create-designer/src directory to your project (recommended location: src/components/FcDesigner), for example:
your-project/
└── src/
    └── components/
        └── FcDesigner/   # Copy here
            β”œβ”€β”€ components/
            β”œβ”€β”€ config/
            β”œβ”€β”€ utils/
            └── index.js
  1. Merge the dependencies field from the source package's package.json into your project's package.json.

  2. Run npm install again to install dependencies.

Project Configuration ​

Vue 2 Project Configuration ​

javascript
// main.js
import Vue from 'vue'
//import FcDesigner from '@form-create/designer'
import FcDesigner from '@/components/FcDesigner'

Vue.use(FcDesigner)

Vue 3 Project Configuration ​

javascript
// main.js
import { createApp } from 'vue'
//import FcDesigner from '@form-create/designer'
import FcDesigner from '@/components/FcDesigner'

const app = createApp(App)
app.use(FcDesigner)

Component Usage ​

vue
<template>
  <fc-designer ref="designer"/>
</template>

<script>
export default {
  mounted() {
    // Access the designer instance
    console.log(this.$refs.designer)
  }
}
</script>