表格新增行,可编辑删除行

表格新增行,可编辑删除行_第1张图片

    
    
地址类型 地址信息 邮编 操作
{{item.type}} {{item.address}} {{item.zipCode}}
const VueApp = {
	setup() {
		const empiData = Vue.ref({
		
		});
		const addressList = Vue.ref([
			{
				"type": "工作单位地址",
				"address": "山东省青岛市市北区福州北路浮山后街道23号",
				"zipCode": "26000",
				"isEdit": false
			},
			{
				"type": "户口地址",
				"address": "山东省青岛市市北区福州北路浮山",
				"zipCode": "26001",
				"isEdit": false
			},
			{
				"type": "籍贯地址",
				"address": "山东省青岛市市北区福州北路浮山",
				"zipCode": "26001",
				"isEdit": false
			}
		]);
		const addAddress = () => {
			for(let i in addressList.value){
				addressList.value[i].isEdit = false;
			}
			addressList.value.push({
				"type": "",
				"address": "",
				"zipCode": "",
				"isEdit": true
			});
		};
		const delAddress = (index) => {
		  addressList.value.splice(index, 1);
		};
		const handleEditAddress = (index, flag) => {
		  addressList.value[index].isEdit = flag;
		};
		return {
			empiData,
			addressList,
			handleEditAddress,
			addAddress,
			delAddress
		};
	},
};
const app = Vue.createApp(VueApp);
app.use(naive);
app.mount("#vue-app");

你可能感兴趣的:(java,前端,服务器)