---
title: "键盘事件"
author: "onlydo"
date: "2012-03-21T19:11:56Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2012-03-25T15:20:25Z"
id: 1460851
url: "https://wodar.iteye.com/blog/1460851"
---

listeners:{		
				scope:this,
	            render:function(panel){
	                panel.el.on('keypress',function(e){
	                	var key = e.getKey();
	    	        	if( key === e.ENTER ){
	    	        		this.login();
	    	            }
	                },this);
	            }
	        }

在组件中添加键盘事件，例如表单回车提交，需要把以上事件在表单render之后添加键盘监听程序。