代码清理 && UI调整
This commit is contained in:
1 parent
b64c952d0f
commit
c44365e44f
3 files changed
+14
-118
No files matched your search
@@ -1,108 +0,0 @@
|
||||
<!-- formItem.html >>>>>>>>>>>>> -->
|
||||
<script type="text/html" id="form-item">
|
||||
<div>
|
||||
<span class="jh-input-label">{{ formItem.statement }}</span>
|
||||
<!-- 文本 -->
|
||||
<v-text-field
|
||||
v-if="formItem.type === 'input'"
|
||||
:rules="validationRules.requireRules"
|
||||
class="jh-v-input"
|
||||
dense single-line filled
|
||||
label=""
|
||||
v-model="formItem.answer"
|
||||
:readonly="typeof readonly == 'boolean'? readonly: readonly.indexOf(formItem.id) > -1"
|
||||
></v-text-field>
|
||||
|
||||
<!-- 文本 -->
|
||||
<v-text-field
|
||||
v-if="formItem.type === 'textarea'"
|
||||
:rules="validationRules.requireRules"
|
||||
class="jh-v-input"
|
||||
dense single-line filled
|
||||
label=""
|
||||
v-model="formItem.answer"
|
||||
:readonly="typeof readonly == 'boolean'? readonly: readonly.indexOf(formItem.id) > -1"
|
||||
></v-text-field>
|
||||
|
||||
<!-- 单选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'single'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
dense single-line filled
|
||||
class="jh-v-input"
|
||||
:rules="validationRules.requireRules"
|
||||
:readonly="typeof readonly == 'boolean'? readonly: readonly.indexOf(formItem.id) > -1"
|
||||
></v-select>
|
||||
|
||||
<!-- 多选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'multiple'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
multiple
|
||||
dense single-line filled
|
||||
class="jh-v-input"
|
||||
:rules="validationRules.requireRules"
|
||||
:readonly="typeof readonly == 'boolean'? readonly: readonly.indexOf(formItem.id) > -1"
|
||||
></v-select>
|
||||
|
||||
<!-- 文本框 -->
|
||||
<v-textarea
|
||||
v-if="formItem.type === 'short'"
|
||||
:rules="validationRules.requireRules"
|
||||
class="jh-v-input" no-resize dense single-line filled
|
||||
label="备注"
|
||||
v-model="formItem.answer"
|
||||
:readonly="typeof readonly == 'boolean'? readonly: false"
|
||||
></v-textarea>
|
||||
|
||||
<!-- 时间选择 -->
|
||||
<v-menu v-if="formItem.type === 'date'" class="jh-v-input" :close-on-content-click="false" v-model="isDataPickerShown"
|
||||
transition="scale-transition" offset-y min-width="auto">
|
||||
<template v-slot:activator="{on, attrs}">
|
||||
<v-text-field class="jh-v-input" dense single-line filled readonly v-on="on" v-bind="attrs" label="出生日期" v-model="formItem.answer"
|
||||
:rules="validationRules.requireRules" :readonly="readonly"></v-text-field>
|
||||
</template>
|
||||
<v-date-picker color="green lighten-1" elevation="20" @input="isDataPickerShown = false" v-model="formItem.answer"></v-date-picker>
|
||||
</v-menu>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('form-item', {
|
||||
template: "#form-item",
|
||||
vueComponent: 'form-item',
|
||||
vuetify: new Vuetify(),
|
||||
props: {
|
||||
formItem: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
readonly: {
|
||||
type: [Array, Boolean],
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isDataPickerShown: false,
|
||||
validationRules: {
|
||||
requireRules: [
|
||||
v => !!v || 'This is required',
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
console.log(this.formItem)
|
||||
},
|
||||
methods: {},
|
||||
});
|
||||
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
<!-- <<<<<<<<<<<<< formItem.html -->
|
||||
Reference in new issue
Block a user