vue-輸入框change事件並獲取值


1.html

<input type="text" @change="specifiName($event)" />//輸入框的change事件
<input type="text" @input="specifiName($event)" />//輸入框的輸入事件
<input type="text" @keyup.enter="specifiName($event)" />//輸入框的回車事件

 

2.js

var vm = new Vue({
    el: "#app",
    methods: {
      specifiName(e) {
        var that = this;
        var val = e.target.value;
        console.log(val);
      },
    }
});

 


免責聲明!

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



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