uni-app input绑定值为空字符时,动态设置内容为数值0无效
uni-app input绑定值为空字符时,动态设置内容为数值0无效
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Windows | w11 | HBuilderX |
示例代码:
<template>
<view>
<input class="uni-input" v-model="number" placeholder="自动获得焦点" />
Home
<button @click="run">Run</button>
</view>
</template>
<script>
export default {
data() {
return {
number:''
}
},
methods: {
run(){
//当原内容为空字符串(number:'')
this.number=0;//无效
//当原内容为非空字符串(number:'*')
// this.number=0;//有效
}
}
}
</script>
操作步骤:
- input绑定值为空字符,动态设置内容为数值0无效
预期结果:
- 数值0应该显示
实际结果:
- 数值0不显示
bug描述:
微信平台:
- 当input绑定值为空字符串的时候,设置number为0无效,
- 当input绑定值为非空字符串的时候,设置number为0有效
安卓和IOS经测试无上述问题
更多关于uni-app input绑定值为空字符时,动态设置内容为数值0无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复