vue-admin-template/src/components/EditList/index.vue

45 lines
765 B
Vue

<template>
<div>
<edit-div
v-for="(item, index) in dataList"
:key="index"
v-model="dataList[index]"
@changeVal="checkList"
:class="{ add: item == '双击添加' }"
></edit-div>
</div>
</template>
<script>
import EditDiv from "@/components/EditDiv/index.vue";
export default {
name: "EditList",
props: ["data"],
data() {
return {
dataList: this.data,
};
},
mounted() {
this.dataList.push("双击添加");
},
methods: {
checkList() {
if (this.dataList[this.dataList.length - 1] != "双击添加") {
this.dataList.push("双击添加");
}
},
},
components: {
EditDiv,
},
};
</script>
<style scoped>
.add {
color: #c0c4cc;
font-size: 0.7em;
}
</style>