Pre Merge pull request !41 from Bleachtred/ts

This commit is contained in:
Bleachtred 2023-09-14 09:38:15 +00:00 committed by Gitee
commit c52267ea52
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 55 additions and 1 deletions

View File

@ -4,6 +4,10 @@ import 'uno.css';
import '@/assets/styles/index.scss';
import 'element-plus/theme-chalk/dark/css-vars.css';
// 表单设计页面样式
import 'vform3-builds/dist/designer.style.css';
import VForm3 from 'vform3-builds';
import ElementPlus from 'element-plus'
// App、router、store
import App from './App.vue';
import store from './store';
@ -51,6 +55,8 @@ app.use(router);
app.use(store);
app.use(i18n);
app.use(plugins);
app.use(VForm3);
app.use(ElementPlus);
// 自定义指令
directive(app);

View File

@ -1,3 +1,51 @@
<template>
<div>表单构建 <svg-icon icon-class="build" /></div>
<div style="margin-left:-200px">
<!-- 表单设计 -->
<v-form-designer class="vform3-designer-container"
ref="vfDesigner"
:designer-config="designerConfig"
>
<template #customToolButtons>
<el-button link type="primary" icon="CircleCheck" @click="saveFormJson">保存</el-button>
</template>
</v-form-designer>
</div>
</template>
<script setup>
const { proxy } = getCurrentInstance()
// ref
const vfDesigner = ref(null)
//
const designerConfig = reactive({
exportJsonButton: true,
importJsonButton: true,
clearDesignerButton: true,
exportCodeButton: true,
generateSFCButton: true,
toolbarMaxWidth: 610 // customToolButtons slot
})
//
const saveFormJson = () => {
let formJson = vfDesigner.value.getFormJson()
if(formJson.widgetList.length == 0){
proxy?.$modal.msgError('请从左侧列表中选择一个组件!')
return
}
//
console.log(JSON.stringify(formJson))
}
</script>
<style lang="scss">
.vform3-designer-container{
.main-header{
display: none !important;
}
.field-wrapper .drag-handler{
top: -20px;
}
}
</style>