SoFunction
Updated on 2025-04-05

vue binds an instance of a number type value as a number

Add directly:

 <el-select v-model="" filterable placeholder="Please select" @change="gamefilter" class="mr40">
   <el-option label="Open" :value='0'></el-option>
   <el-option label="closure" :value='1'></el-option>

   <!-- <el-option label="closure" :value='1'> -->
   
   </el-select>

Supplementary knowledge:In vue input and select tags, the value bound to v-model is numeric type.

Background: The value bound to the input tag v-model in the vue form is automatically converted to String type by default, but sometimes we don't want it to automatically convert, so what should we do?

1. Use number to change the bound v-model to number type

<el-input type="number" ="age"></el-input>

2. The value bound to the option of the drop-down box is a number, but the v-model is String type, use:value

&lt;el-select v-model="" placeholder="Please select menu level"&gt;
  &lt;el-option label="system" :value="0"&gt;&lt;/el-option&gt;
  &lt;el-option label="Module" :value="1"&gt;&lt;/el-option&gt;
  &lt;el-option label="Function" :value="2"&gt;&lt;/el-option&gt;
&lt;/el-select&gt;

The above example of vue binding the number type value as a number is all the content I share with you. I hope you can give you a reference and I hope you support me more.