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;
        }
    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM