表单
This commit is contained in:
1 parent
ecc057d869
commit
1232d10528
8 files changed
+706
-59
No files matched your search
@@ -0,0 +1,91 @@
|
||||
|
||||
<template id="tpl-form-design">
|
||||
<div class="tpl-form-design-container">
|
||||
<form-item-list-generator
|
||||
:form-item-list="form"
|
||||
ref="formItemListGenerator"/>
|
||||
|
||||
<!-- <v-navigation-drawer v-model="formItemListPreviewDrawer" fixed temporary bottom width="90%">
|
||||
<v-toolbar dark class="blue darken-3" dense>
|
||||
<v-toolbar-title>表单预览</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-toolbar-items>
|
||||
<v-btn dark text @click="formItemListPreviewDrawer = false">关闭</v-btn>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
<v-card class="mt-3">
|
||||
<v-row>
|
||||
<v-col cols="12" md="6" class="pa-0">
|
||||
<codemirror v-model="JSON.stringify(formItemList, null, 4)" :options="codemirrorOptions"/>
|
||||
</v-col>
|
||||
<v-col cols="12" md="6">
|
||||
<form-item-list-render :form-item-list="formItemList"></form-item-list-render>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-navigation-drawer> -->
|
||||
</div>
|
||||
</template>
|
||||
<script type="module">
|
||||
Vue.component("tpl-form-design", {
|
||||
template: "#tpl-form-design",
|
||||
props: {
|
||||
form: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
}),
|
||||
computed: {
|
||||
versionList () {
|
||||
const list = this.articleAssignmentListWithAnswer.map(item => {
|
||||
return { text: item.version, value: item.version }
|
||||
})
|
||||
return list;
|
||||
},
|
||||
formItemList () {
|
||||
let list = []
|
||||
if (this.articleAssignmentListWithAnswer[this.selectedVersionIndex]) {
|
||||
list = this.articleAssignmentListWithAnswer[this.selectedVersionIndex].formItemList;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 每个属性值发生变化就会调用这个函数
|
||||
form(newVal, oldVal) {
|
||||
this.saveData(newVal)
|
||||
},
|
||||
// 深度监听 属性的变化
|
||||
deep: true
|
||||
},
|
||||
async created() {
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
saveData(newVal) {
|
||||
// this.$emit('change-structure', this.form);
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tpl-form-design-container {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
@media (max-width: 500px) {
|
||||
.tpl-form-design-container {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-height: none;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user