parent
05d2b0c408
commit
279105908f
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "variant-form",
|
||||
"version": "2.2.8",
|
||||
"version": "2.2.9",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve --open src/main.js",
|
||||
|
|
10
src/App.vue
10
src/App.vue
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div id="app">
|
||||
<VFormDesigner ref="vfDesignerRef" :designer-config="designerConfig">
|
||||
<VFormDesigner ref="vfDesignerRef" :designer-config="designerConfig" :global-dsv="globalDsv">
|
||||
<template #customToolButtons>
|
||||
<el-button type="text" @click="printFormJson">测试按钮</el-button>
|
||||
</template>
|
||||
|
@ -21,7 +21,13 @@ export default {
|
|||
designerConfig: {
|
||||
resetFormJson: false,
|
||||
toolbarMaxWidth: 490,
|
||||
}
|
||||
},
|
||||
|
||||
//全局数据源变量
|
||||
globalDsv: {
|
||||
testApiHost: 'http://www.test.com/api',
|
||||
testPort: 8080,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export default {
|
||||
inject: ['getGlobalDsv'],
|
||||
methods: {
|
||||
appendTableRow(widget) {
|
||||
this.designer.appendTableRow(widget)
|
||||
|
|
|
@ -2,7 +2,7 @@ import {deepClone} from "@/utils/util"
|
|||
import FormValidators from '@/utils/validators'
|
||||
|
||||
export default {
|
||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel', 'getOptionData'],
|
||||
inject: ['refList', 'formConfig', 'getGlobalDsv', 'globalOptionData', 'globalModel', 'getOptionData'],
|
||||
|
||||
computed: {
|
||||
subFormName() {
|
||||
|
|
|
@ -49,11 +49,16 @@
|
|||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
globalDsv: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
refList: this.widgetRefList,
|
||||
formConfig: this.formConfig,
|
||||
getGlobalDsv: () => this.globalDsv, // 全局数据源变量
|
||||
globalOptionData: this.optionData,
|
||||
getOptionData: () => this.optionData,
|
||||
globalModel: {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<el-container class="center-layout-container">
|
||||
<el-header class="toolbar-header">
|
||||
<toolbar-panel :designer="designer" ref="toolbarRef">
|
||||
<toolbar-panel :designer="designer" :global-dsv="globalDsv" ref="toolbarRef">
|
||||
<template v-for="(idx, slotName) in $slots" #[slotName]>
|
||||
<slot :name="slotName"></slot>
|
||||
</template>
|
||||
|
@ -45,14 +45,15 @@
|
|||
</el-header>
|
||||
<el-main class="form-widget-main">
|
||||
<el-scrollbar class="container-scroll-bar" :style="{height: scrollerHeight}">
|
||||
<v-form-widget :designer="designer" :form-config="designer.formConfig" ref="formRef">
|
||||
<v-form-widget :designer="designer" :form-config="designer.formConfig" :global-dsv="globalDsv" ref="formRef">
|
||||
</v-form-widget>
|
||||
</el-scrollbar>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
<el-aside>
|
||||
<setting-panel :designer="designer" :selected-widget="designer.selectedWidget" :form-config="designer.formConfig" />
|
||||
<setting-panel :designer="designer" :selected-widget="designer.selectedWidget"
|
||||
:form-config="designer.formConfig" :global-dsv="globalDsv" />
|
||||
</el-aside>
|
||||
</el-container>
|
||||
|
||||
|
@ -127,6 +128,12 @@
|
|||
}
|
||||
},
|
||||
|
||||
/* 全局数据源变量 */
|
||||
globalDsv: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -114,6 +114,10 @@
|
|||
designer: Object,
|
||||
selectedWidget: Object,
|
||||
formConfig: Object,
|
||||
globalDsv: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<div>
|
||||
<div class="form-render-wrapper" :class="[layoutType === 'H5' ? 'h5-layout' : (layoutType === 'Pad' ? 'pad-layout' : '')]">
|
||||
<VFormRender ref="preForm" :form-json="formJson" :form-data="testFormData" :preview-state="true"
|
||||
:option-data="testOptionData"
|
||||
:option-data="testOptionData" :global-dsv="designerDsv"
|
||||
@appendButtonClick="testOnAppendButtonClick" @buttonClick="testOnButtonClick"
|
||||
@formChange="handleFormChange">
|
||||
<!--
|
||||
|
@ -191,7 +191,11 @@
|
|||
SvgIcon,
|
||||
},
|
||||
props: {
|
||||
designer: Object
|
||||
designer: Object,
|
||||
globalDsv: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
},
|
||||
inject: ['getDesignerConfig'],
|
||||
data() {
|
||||
|
@ -274,6 +278,10 @@
|
|||
return this.designer.getLayoutType()
|
||||
},
|
||||
|
||||
designerDsv() {
|
||||
return this.globalDsv
|
||||
}
|
||||
|
||||
},
|
||||
watch: {
|
||||
'designer.widgetList': {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { traverseFieldWidgetsOfContainer } from "@/utils/util";
|
||||
|
||||
export default {
|
||||
inject: ['getGlobalDsv'],
|
||||
computed: {
|
||||
customClass() {
|
||||
return this.widget.options.customClass || ''
|
||||
|
|
|
@ -74,13 +74,18 @@
|
|||
previewState: { //是否表单预览状态
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
globalDsv: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
refList: this.widgetRefList,
|
||||
sfRefList: this.subFormRefList, //收集SubForm引用
|
||||
formConfig: this.formConfig,
|
||||
getGlobalDsv: () => this.globalDsv, // 全局数据源变量
|
||||
globalOptionData: this.optionData,
|
||||
getOptionData: () => this.optionData, /* 该方法用于在异步更新option-data之后重新获取到最新值 */
|
||||
globalModel: {
|
||||
|
@ -695,6 +700,14 @@
|
|||
return this.externalComponents[componentName]
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取globalDsv对象
|
||||
* @returns {*}
|
||||
*/
|
||||
getGlobalDsv() {
|
||||
return this.globalDsv
|
||||
},
|
||||
|
||||
//--------------------- 以上为组件支持外部调用的API方法 end ------------------//
|
||||
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export const VARIANT_FORM_VERSION = '2.2.8'
|
||||
export const VARIANT_FORM_VERSION = '2.2.9'
|
||||
|
||||
//export const MOCK_CASE_URL = 'https://www.fastmock.site/mock/2de212e0dc4b8e0885fea44ab9f2e1d0/vform/'
|
||||
export const MOCK_CASE_URL = 'https://ks3-cn-beijing.ksyuncs.com/vform-static/vcase/'
|
||||
|
|
Loading…
Reference in New Issue