图例

UniApp给input输入框增加删除按钮“清除小叉叉x”

<view class="pt10 flex alcenter">
 <view class="ft16 ftw500 text-info">手机号</view>
   <input class="ml40" maxlength="11" :value="phone" type="text" placeholder-style="color:#cccccc;" placeholder="输入手机号码" @input="theBlur" />
   <text v-if="phone" class="icon_close" @click="close"></text>
</view>
data(){
  phone:'',
},
methods:{ close:function(){
this.phone = '' }, theBlur(e){ console.log(e.target.value) this.phone = e.target.value } },
//css
.icon_close {
            background-image: url(../../../static/images/btn_close3@3x.png); 
            background-position: center center;
            background-repeat: no-repeat;
            background-size: cover;
            width: 42upx;
            height: 32upx;
            margin-right: 10upx;
        }
    

 

相关文章:

  • 2021-06-08
  • 2022-01-15
  • 2021-10-03
  • 2021-06-23
  • 2022-12-23
  • 2021-11-30
  • 2021-04-24
猜你喜欢
  • 2022-02-25
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2021-11-15
  • 2021-07-03
相关资源
相似解决方案