javascript - 为什么监听器不工作?
问题描述
为什么第一个监听器不工作而另一个监听器工作?
如何设置第一个监听器工作?
也许问题与范围有关,这个?
如何设置它以查看 MainControllers 中可用的功能?
是现代版ExtJS 6.2
结构文件夹:
//FeedViewer
//app
//view
//main
/MainController.js
/MainModel.js
/FeedForm.js
/Feeds.js
//classic
//modern
//src
//view
//main
/Main.js
主控制器.js:
Ext.define('FeedViewer.view.main.MainController', {
extend: 'Ext.app.ViewController',
alias: 'controller.main',
onNewFeed: function () {
alert('Hello');
}
});
Feeds.js:
Ext.define('FeedViewer.view.main.Feeds', {
extend: 'Ext.grid.Grid',
xtype: 'feedslist',
requires: [
'ContactsApp.view.feeds.MainController',
'ContactsApp.view.feeds.MainModel'
],
viewModel: 'feeds',
controller: 'feeds',
columns: [{
dataIndex: 'feed',
text: 'feed'
}],
items: [{
xtype: 'toolbar',
docked: 'left',
items: [{
xtype: 'button'
text: 'Add New Feed',
iconCls: 'fa fa-plus',
listeners: {
click: 'onNewFeed' * * //It doesn't work**
}
}]
}],
listeners: {
select: 'onNewFeed' * * //It works**
}
});
解决方案
在现代工具包Ext.Button
中,点击事件被称为tap
. 你也可以使用handler
配置。这是小提琴
推荐阅读
- javascript - accounts-js GraphQL 客户端身份验证突变不起作用
- python - 是否有不同的方法来创建菜单栏?
- next.js - React 服务器不匹配:Prop `className` 不匹配
- c++ - 从 int 到具有非固定基础类型的作用域枚举的 constexpr 静态转换的未定义行为在 C++17 中编译
- python-sphinx - 创建 Sphinx reStructuredText 章节组
- c# - C# Visual Studio 用正常语法替换 => 的任何方式
- python - 使用来自日志文件的成功状态消息过滤和验证 IPv4 和 IPv6 的 Python 解决方案
- python-docx - 仅在一个表格行而不是整个文档上设置字体颜色
- mysql - 只返回 1 行?
- if-statement - Tableau - 满足 IF 条件的多个记录