<template>
	<div class="tableInner">
		<el-input
			v-if="list.isEdit"
			type="number"
			v-model="list[itemProp]"
			@blur="changeInput" />
		<span v-else>{{ list[itemProp] }}</span>
	</div>
</template>
<script>
export default {
	name: 'InputArea',
	props: {
		injectData: {
			type: Object,
			default: () => ({}),
		},
		itemProp: {
			type: String,
		},
	},
	data() {
		return {
			list: {},
		};
	},
	mounted() {
		this.initData();
	},
	watch: {
		injectData() {
			this.initData();
		},
	},
	methods: {
		initData() {
			this.list = this.injectData;
		},
		changeInput() {
			this.$emit('emitData', this.list);
		},
	},
};
</script>
