What could be causing my Vuetify v-select in Vue 3 to send [object Object] instead of the chosen value?

I'm currently tackling a Vue 3 project with Vuetify, and I've encountered an issue involving a v-select component. The selected value is appearing as [object Object] instead of its actual value.

Here's a simplified snippet of my code:

Parent Component

<template>
  <v-container>
    ...
  </v-container>
</template>

<script setup>
...
</script>

Child Component (ComponentStatusSelect.vue)

<template>
  ...
</template>

<script setup>
...
</script>

Issue: Upon selection in the v-select, the sent backend value displays as [object Object] rather than the expected value.

Solutions Attempted:

  1. Validated that the componentStatusOptions contain text and value properties.
  2. Confirmed that the v-select uses item-title="text" and item-value="value" attributes.
  3. Inserted console logs to check the selected value.

Desired Outcome: The selected value should be transmitted as a corresponding string (e.g., 'A', 'M', 'D').

Current Outcome: The chosen value registers as [object Object].

Answer №1

Consider utilizing the defineModel() function instead of using model-value in your child component

<template><v-select v-model="model" ...></v-select></template>
<script setup>const model = defineModel()</script>

and within the parent component

<ComponentStatusSelect v-model="selectedComponentStatus" />

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the most efficient way to transmit JSON data from a browser to a REST endpoint via Node.js, specifically in gzip format?

Currently working with node.js and express, I have a home page that hits my REST endpoint (PUT) after loading to send some JSON data. The data is not gziped when sending to the endpoint, but I want it to be in gzip form once it reaches the endpoint. Is thi ...

Variations of a particular software package are necessary

My current project requires Expo, React, and React-Native as dependencies. The configuration in the package.jason file looks like this: "main": "node_modules/expo/AppEntry.js", "private": true, "dependencies": { "expo": "^28.0.0", "expo-three": "^ ...

Converting CSV into an Array of Hash Tables

Currently, I am working on parsing a CSV file and creating an array of hashes. While I initially implemented this using my own code, I feel that it may not be the most efficient solution. My aim is to utilize the CSV-Parser library, but so far, I have only ...

I'm feeling a bit lost when it comes to assigning and defining variables in AngularJS,

Currently embarking on developing my own game leveraging the latest JavaScript, AngularJS, and Node.js technologies. My approach in handling users and players is inspired by the code found here: https://github.com/amirrajan/nodejs-against-humani ...

Altering the display attribute cancels out any opacity transitions

When using JavaScript to change the opacity of an element with transition: opacity 1s, the expected duration of one second is met, as demonstrated here: onload = e => { var p = document.getElementsByTagName("p")[0]; p.style.opacity = 1; }; p { ...

Unable to install vuex using npm

$ npm install vuex --save npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="35434050 ...

Steps to create a zigzagging line connecting two elements

Is it possible to create a wavy line connecting two elements in HTML while making them appear connected because of the line? I want it to look something like this: Take a look at the image here The HTML elements will be structured as follows: <style&g ...

When attempting to use JSON.parse, it returns an undefined value

When using PHP to create JSON data and retrieving it through AJAX, why does JSON.parse return an "undefined" object? PHP CODE $emparray = array(); while($row =mysqli_fetch_assoc($result)) { $emparray[] = $row; } echo json_encode($emparray); AJ ...

Avoid the presence of HTML tags in the content before using the Google Translate API for

I have recently learned about the <span class="e;notranslate"e;> </span> tag that is used to prevent text from being translated within the span element. My goal now is to send content with HTML tags to the Translate API and have it return with ...

What could be causing the data toggle feature in my navbar to not work on Bootstrap?

Here is a code snippet to create a simple collapsible navbar with Bootstrap 5 that includes a logout button. However, the data toggle feature for the logout button doesn't seem to work when clicked. Any suggestions on how to fix this? <!DOCTYPE ...

Utilize both parent component styling passed down through props and component-specific styling in React Native

Can specific styling properties be set from the parent component as props while others are set within the component itself? Below is the code for the component: import React,{ Component } from 'react'; import { View, Text } from 'react-nat ...

The Jquery instructions were not executed

Enjoy your day! I have recently downloaded the latest compressed version of jQuery from a lesson site here (Download the compressed, production jQuery 3.6.0) After that, in my HTML document, I included it like this: <head> <meta charset = &qu ...

What is the best way to align HTML inputs within a grid, whether it be done automatically or manually using JavaScript?

Arrange 20 HTML inputs with various data types into grid-columns as the user inputs data. Ensure that the grid container has div elements correctly positioned for output. ...

Unable to successfully import an external HTML file that contains a script tag

I am currently experiencing an issue with my index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8> <title>MyApp</title> <link rel="import" href="./common.html"> </head> <body> ...

Having trouble with loading images from the assets folder, keep encountering a 304 error

While attempting to load a PNG file from the assets folder, I encountered a 304 error. My goal is to load images from the assets folder. const path = require('path'); const express = require('express'); const webpack = require('we ...

Sort through an array using various prefixes and suffixes as filtering conditions

I have come across various questions and answers related to this particular issue, but most of them involve using the includes or indexOf methods. The problem at hand is how to filter an array (names in this scenario) using two different arrays - one with ...

Tips on leveraging LocalStorage to update state in ReactJS

In my code, an array fetches API data each time componentDidMount() is called. Within this array, each element contains an object with a default boolean value of true. An onClick function toggles the boolean value of a specific element to false when clicke ...

Challenge encountered when converting React function component into a class component

I've developed a react functional component that aids in supporting authentication required routes with react-router. const PrivateRoute = ({ component: Component, ...rest }) => ( <Route {...rest} render={props => ( isAuthenticated() ? ...

Error encountered while making an http get request for a node that returns JSON

I've been struggling with this issue for quite some time now. While I've come across similar problems on Stack Overflow, none of the suggested solutions seem to work for me. I keep encountering the following error message: undefined:1 SyntaxErro ...

Tips on adding background images to your chart's background

Is there a way to set an image as the background in Lightning Chart using chartXY.setChartBackground? ...