- 发布:2023-09-25 16:02
- 更新:2023-12-26 16:15
- 阅读:322
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 11
HBuilderX类型: 正式
HBuilderX版本号: 3.8.7
手机系统: Android
手机系统版本号: Android 12
手机厂商: 华为
手机机型: 红米note11tpro
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
<uni-tr>
<uni-td align="center">宽(cm)</uni-td>
<uni-td align="center">
<u-input v-model="item.width" type="number" placeholder="请输入宽度"
@blur="updataTable(index,1,item.width)" :disabled="item.isDefaultSizeUp=='N' || item.wid "
@focus="getFocus(item.width,'width',index)" @input="getInput($event,index)"
v-if="item.width!=''"></u-input>
<u-input type="number" placeholder="请输入宽度" v-else @blur="updataTable(index,1,item.width)"
disabled="item.isDefaultSizeUp=='N' || item.wid "
@focus="getFocus(item.width,'width',index)" @input="getInput($event,index)"></u-input>
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)"
disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)" disabled="item.isDefaultSizeUp=='N' || item.hei" @focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
预期结果:
<uni-tr>
<uni-td align="center">宽(cm)</uni-td>
<uni-td align="center">
<u-input v-model="item.width" type="number" placeholder="请输入宽度"
@blur="updataTable(index,1,item.width)" :disabled="item.isDefaultSizeUp=='N' || item.wid "
@focus="getFocus(item.width,'width',index)" @input="getInput($event,index)"
v-if="item.width!=''"></u-input>
<u-input type="number" placeholder="请输入宽度" v-else @blur="updataTable(index,1,item.width)"
disabled="item.isDefaultSizeUp=='N' || item.wid "
@focus="getFocus(item.width,'width',index)" @input="getInput($event,index)"></u-input>
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)"
disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)" disabled="item.isDefaultSizeUp=='N' || item.hei" @focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
实际结果:
<uni-tr>
<uni-td align="center">宽(cm)</uni-td>
<uni-td align="center">
<u-input v-model="item.width" type="number" placeholder="请输入宽度"
@blur="updataTable(index,1,item.width)" :disabled="item.isDefaultSizeUp=='N' || item.wid "
@focus="getFocus(item.width,'width',index)" @input="getInput($event,index)"
v-if="item.width!=''"></u-input>
<u-input type="number" placeholder="请输入宽度" v-else @blur="updataTable(index,1,item.width)"
disabled="item.isDefaultSizeUp=='N' || item.wid "
@focus="getFocus(item.width,'width',index)" @input="getInput($event,index)"></u-input>
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)"
disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)" disabled="item.isDefaultSizeUp=='N' || item.hei" @focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
bug描述:
</uni-td>
</uni-tr>
<uni-tr>
<uni-td align="center">高(cm)</uni-td>
<uni-td align="center">
<u-input type="number" v-model="item.height" placeholder="请输入高度"
@blur="updataTable(index,2,item.height)" :disabled="item.isDefaultSizeUp=='N' || item.hei"
@focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"
v-if="item.height!=''"></u-input>
<u-input type="number" placeholder="请输入高度" v-else @blur="updataTable(index,2,item.height)" disabled="item.isDefaultSizeUp=='N' || item.hei" @focus="getFocus(item.height,'height',index)" @input="getInput2($event,index)"></u-input>
</uni-td>
</uni-tr>
风之源
不用v-model试试,用@blur更新
2023-09-25 16:11
p***@163.com (作者)
回复 风之源: 不用v-model我没法赋值,业务需求input框的值是可以输入可以赋值的
2023-09-25 16:18