Last active
December 31, 2020 14:53
-
-
Save VisionYi/c341e21ca033f3bb38f8cef37db27b79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div v-for="(item, index) in valueSync" :key="item.id"> | |
name: <input type="text" v-model="item.name" @input="syncPropValue"> | |
years: <input type="number" v-model="item.year" @input="syncPropValue"> | |
<button @click="removePepole(index)">remove</button> | |
</div> | |
</template> | |
<script> | |
export default { | |
//... | |
medthods: { | |
removePepole(index) { | |
this.valueSync.splice(index, 1) | |
this.syncPropValue() | |
}, | |
syncPropValue(value) { | |
this.$emit('input', this.valueSync) | |
}, | |
}, | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment