Enter Vue monitor events

  • After the function to create the life cycle, in response to the Enter event
    Created: function () {
     var _this = the this ; 
    document.onkeydown = function (E) {    // press Enter to submit 
        the let Key = window.event.keyCode;  
         // event keycode = 13 to carriage event 
        IF (Key 13 is == ) { 
            _this.append (); 
        } 
    }; 
    },
  • Event Method
    the append: function () { 
            Alert ( "I ENTER" ); 
        },

Guess you like

Origin www.cnblogs.com/u-damowang1/p/12158394.html