I am working with a Vue.js app and attempting to update a value inside an object. Specifically, I want to change the 'name' value when the @change="onfilechangev" event occurs. Is there a way to achieve this, or is it not possible to update an object in this manner?
app.js
const vm = new Vue({
el: '#regapp',
data: {
team:[
{
img: '',
name: '',
}
],
},
methods: {
onfilechangev(event) {
let uploads = event.target.files[0]
let pic = uploads.name;
Vue.set(vm.team.name, 'pic', )
},
Thank you for any guidance provided. Despite my best efforts, I have been unable to successfully implement this functionality. To illustrate my issue further, I have adapted the codesandbox example below to reflect my specific scenario. https://codesandbox.io/s/736nqq6070 In essence, I am dynamically adding fields with the option for profile image upload. Upon adding multiple team members, I intend to save their information in a Laravel backend database. When selecting an image, it gets pushed to the selectedFile array (which works as expected). However, since the profile picture is optional, I need a way to determine if a team member has uploaded an image or not. This is why I am trying to set a hidden input field for the filename, allowing me to check later on the backend whether each team member includes an image file name for saving purposes.