Vue converts input[type=number] to a string value

You need to use .number modifier for v-model, like this:

<input v-model.number="quantity" type="number">

Note: empty string ('') is not converted to a number, so you may need to handle it separately.


Change the order object to :

const order = {
    stockId: this.stock.id,
    stockPrice: this.stock.price,
    quantity: +this.quantity
};

This will automatically parse the string to a number.

In general the data from HTML inputs are strings. The input type only checks if a valid string has been provided in the field.