Vue el-input實現動態顯示type為textarea的文字數量、剩余字數


<el-form-item label="主廚描述">
    <el-input v-model="chef_desc" :autosize="{ minRows: 2, maxRows: 4}" type="textarea" maxlength="128" @input="descInput" placeholder="請輸入..." />
    <span class="numberV" style="position: absolute; right: 10px;bottom: 0;">{{txtVal}}/128</span>
</el-form-item>
data() {
    return {
        txtVal: 0,
    }
},
 methods: {
    /**
     * 統計textarea 字數
     */
    descInput() {
      this.txtVal = this.chef_desc.length;
    }
}

 


免責聲明!

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



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