Vue3+element-plus el-from中el-select选中后无法回显

Vue3+element-plus el-from中el-select选中后无法回显

<el-form 
   :inline="true"
   label-position="top" 
   :model="packageForm" 
   :rules="packageRules"
   ref="packageForm"
   label-width="120px" 
   class="customForm"
 >
   <el-form-item label="添加套餐类型:" prop="packageType">
     <el-select v-model="packageForm.packageType" placeholder="请选择套餐类型" @change="changePackageType">
       <el-option
         v-for="item in package_type"
         :key="item.value"
         :label="item.label"
         :value="Number(item.value)"
       />
     </el-select>
   </el-form-item>
   <el-form-item label="套餐名称:" prop="packageName">
     <el-input v-model="packageForm.packageName" placeholder="请输入套餐名称"/>
   </el-form-item>
 </el-form>

其中问题是el-from的ref和model命名packageForm一样,在vue2可以使用,vue3中会出问题,只需要区分命名就可以解决问题

你可能感兴趣的:(vue,前端,vue.js,javascript,前端,elementui)