You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.1 KiB
Vue
60 lines
1.1 KiB
Vue
5 months ago
|
<script lang="ts">
|
||
|
import hwInputView from './viewElements/hw-input-view.vue';
|
||
|
import hwFormView from './viewElements/hw-form-view.vue';
|
||
|
|
||
|
export default {
|
||
|
name: 'hw-form',
|
||
|
components: {
|
||
|
hwInputView,
|
||
|
hwFormView
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<div class="hw-form">
|
||
|
<div v-for="i in widgetList" :key="i.uuid">
|
||
|
<component :is="i.type+'-view'" :options="i.options" :tasks="i.tasks" :formData="formData" />
|
||
|
</div>
|
||
|
{{ formData }}
|
||
|
</div>
|
||
|
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts" setup>
|
||
|
|
||
|
const props = defineProps({
|
||
|
widgetList: Object
|
||
|
});
|
||
|
|
||
|
const { widgetList } = toRefs(props);
|
||
|
|
||
|
const formData = ref({ pageVariable: {} });
|
||
|
const formDataOperation = {
|
||
|
get: (key) => {
|
||
|
return formData.value.pageVariable[key];
|
||
|
},
|
||
|
set: (key, value) => {
|
||
|
formData.value.pageVariable[key] = value;
|
||
|
}
|
||
|
};
|
||
|
provide('formDataOperation', formDataOperation);
|
||
|
</script>
|
||
|
<style scoped lang="less">
|
||
|
.hw-form {
|
||
|
min-height: 20px;
|
||
|
border: 1px dashed #ccc;
|
||
|
margin: 2px;
|
||
|
padding: 2px;
|
||
|
position: relative;
|
||
|
|
||
|
&:hover {
|
||
|
background-color: #0001;
|
||
|
border-color: #00afff;
|
||
|
}
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
|
||
|
|