Incorporating PrimeVue and Multiselect, I am attempting to dynamically generate a list of objects. By using a simple v-model binding to a variable, a list of selected options is created.
<MultiSelect v-model="selected_signals" optionLabel="name" optionValue="name" :options="simu_signals" />
If we consider selecting 3 signals, the output would be:
selected_signals = ['signal1', 'signal2', 'signal3']
My objective is to create an object with the default configuration of each selected signal every time an option is chosen. For the same 3 signals as before, the desired output should be:
selected_signals = [{
name: 'signal1',
interpolation: true,
unit: '',
type: 'origin'
},
{
name: 'signal2',
interpolation: true,
unit: '',
type: 'origin'
},
{
name: 'signal3',
interpolation: true,
unit: '',
type: 'origin'
},
]
I have been struggling with this task, attempting to listen for the @change event and then construct the necessary structure. However, I faced difficulties because Multiselect is not bound to any values, making it challenging to manipulate the selected options.