首页 > 解决方案 > ExtJS - 将商店添加到实用程序类

问题描述

我应该如何在 ExtJS 6.2.1 的实用程序类中使用商店?

在 Grid 组件中,您可以这样做:

Ext.define('App.MyGrid', {
   extend : 'Ext.grid.Grid',
   store  : 'myStore',
});

如果我在课堂上这样做:

Ext.define('App.MyClass', {
   singleton : true,
   store     : 'myStore',
});

thenstore只是一个字符串。

标签: javascriptclassextjsstore

解决方案


您可以使用:

Ext.StoreManager.lookup(STORE_NAME)

推荐阅读