|
@@ -15,14 +15,16 @@
|
|
|
:key="index"
|
|
|
style="margin:15px"
|
|
|
>
|
|
|
- <el-col :style="{width: lableWidth}" class="label">{{ lable[0] }}:</el-col>
|
|
|
- <el-col :style="{width: inputWidth}">
|
|
|
- <el-input v-model="value[lable[0]][index]"></el-input>
|
|
|
- </el-col>
|
|
|
- <el-col :style="{width: lableWidth}" class="label">{{ lable[1] }}:</el-col>
|
|
|
- <el-col :style="{width: inputWidth}">
|
|
|
- <el-input v-model="value[lable[1]][index]"></el-input>
|
|
|
- </el-col>
|
|
|
+ <div v-for="(S_item, S_index) in title" :key="S_index">
|
|
|
+ <el-col
|
|
|
+ :style="{width: titleWidth}"
|
|
|
+ class="label"
|
|
|
+ >{{ title[S_index] || lable[S_index] }}:</el-col>
|
|
|
+ <el-col :style="{width: inputWidth}">
|
|
|
+ <el-input v-model="value[lable[S_index]][index]"></el-input>
|
|
|
+ </el-col>
|
|
|
+ </div>
|
|
|
+
|
|
|
<el-col :style="{width: '120px'}">
|
|
|
<el-button
|
|
|
v-show="listLength.length == index+1"
|
|
@@ -42,12 +44,19 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-
|
|
|
<script>
|
|
|
/*
|
|
|
v-model 数据结构 {key: Array, val: Array} key 和 val 字段可自定义
|
|
|
-lableWidth lable的宽 统一设置 默认值100px
|
|
|
-inputWidth input的宽 统一设置 默认值200px
|
|
|
+titleWidth String lable的宽 统一设置 默认值100px
|
|
|
+inputWidth String input的宽 统一设置 默认值200px
|
|
|
+title Array 设置输入框的标题 不设置默认取 v-model 对象的key
|
|
|
+
|
|
|
+
|
|
|
+<formList v-model="data"></formList>
|
|
|
+data: {
|
|
|
+ 时间: [1,2,33],
|
|
|
+ 值: [1,2,3,4,5]
|
|
|
+},
|
|
|
|
|
|
事件
|
|
|
*/
|
|
@@ -74,7 +83,13 @@ export default {
|
|
|
},
|
|
|
props: {
|
|
|
value: undefined,
|
|
|
- lableWidth: {
|
|
|
+ title: {
|
|
|
+ type: Array,
|
|
|
+ default() {
|
|
|
+ return Object.keys(this.value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ titleWidth: {
|
|
|
type: String,
|
|
|
default: "100px"
|
|
|
},
|
|
@@ -84,6 +99,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {},
|
|
|
+ mounted() {
|
|
|
+ },
|
|
|
methods: {
|
|
|
minus() {
|
|
|
// 保证数组长度一致
|