我创建了这几个函数以从文本确认中检索值,但是当我按下 Enter 时它没有调用?无论如何我可以调用这个函数
适应文本确认.js
function(ComponentView, Adapt) {
var TextConfirmation = ComponentView.extend({
events: {
'click [type="checkbox"]': 'onConfirmation',
'keyup .component-item input':'onKeyPress'
//This is new Code
}
onKeyPress: function(event) {
if (event.which !== 13) return;
//<ENTER> keypress
this.getDatabaselink(event);
//This is new Method
},
getDatabaselink: function() {
datalink = Adapt.course.get('_globals')._components._textConfirmation.Database
console.log("datalink "+ datalink)
//This is new Method
},
属性.schema
"Database": {
"type": "string",
"required": true,
"default": "",
"inputType": "Text",
"validators": [],
"help": "This is the label for Database link",
"translatable": true
}