许多类在使用配置对象创建(实例化)类时都有快捷名称。快捷名称被称为 别名
(如果类扩展了 Ext.Component,则为 xtype
)。别名/xtype 列在适用类的类名旁边,以供快速参考。
框架类或其成员可以指定为 private
或 protected
。否则,类/成员为 public
。Public
、protected
和 private
是访问描述符,用于传达类或类成员应如何以及何时使用。
Public 类和类成员可供任何其他类或应用程序代码使用,并且在主要产品版本中可以作为稳定且持久的依赖项。Public 类和成员可以通过子类安全地扩展。
Protected 类成员是稳定的 public
成员,旨在由所有者类或其子类使用。Protected 成员可以通过子类安全地扩展。
Private 类和类成员在框架内部使用,不供应用程序开发人员使用。Private 类和成员可能会随时更改或从框架中省略,恕不另行通知,不应在应用程序逻辑中依赖。
static
标签。*请参阅下面的静态。下面是一个示例类成员,我们可以对其进行剖析,以展示类成员的语法(在本例中,从 Ext.button.Button 类查看的 lookupComponent 方法)。
让我们看看成员行的每个部分
lookupComponent
)( item )
)Ext.Component
)。对于不返回除 undefined
之外任何内容的方法,可以省略此项,或者可以显示为以正斜杠 /
分隔的多个可能值,表示返回的内容可能取决于方法调用的结果(即,如果 get 方法调用成功,则方法可能返回 Component,如果失败,则返回 false
,这将显示为 Ext.Component/Boolean
)。PROTECTED
- 请参阅下面的标志部分)Ext.container.Container
)。如果成员源自当前类,则源类将显示为蓝色链接,如果成员是从祖先类或混入类继承而来,则显示为灰色。view source
)item : Object
)。undefined
之外的值,则“返回值”部分将注明返回的类或对象类型以及描述(示例中的 Ext.Component
)Available since 3.4.0
- 示例中未显示),紧跟在成员描述之后Defaults to: false
)API 文档使用许多标志来进一步传达类成员的功能和意图。标签可以用文本标签、缩写或图标表示。
classInstance.method1().method2().etc();
false
,则标记为 preventable 的事件将不会触发- 表示框架类
- Singleton 框架类。*有关更多信息,请参阅 singleton 标志
- 组件类型框架类(Ext JS 框架中扩展 Ext.Component 的任何类)
- 表示类、成员或指南在当前查看的版本中是新的
- 表示类型为 config
的类成员
- 表示类型为 property
的类成员
- 表示类型为 method
的类成员
- 表示类型为 event
的类成员
- 表示类型为 theme variable
的类成员
- 表示类型为 theme mixin
的类成员
- 表示类、成员或指南在当前查看的版本中是新的
在 API 文档页面上的类名正下方是一行按钮,对应于当前类拥有的成员类型。每个按钮都显示按类型划分的成员计数(此计数在应用过滤器时会更新)。单击按钮将导航到该成员部分。将鼠标悬停在成员类型按钮上将显示该类型的所有成员的弹出菜单,以便快速导航。
与类配置选项相关的 Getter 和 Setter 方法将显示在方法部分以及 API 文档和成员类型菜单的配置部分中,就在它们所对应的配置下方。Getter 和 Setter 方法文档将在配置行中找到,以便于参考。
您的页面历史记录保存在本地存储中,并显示在顶部标题栏下方(使用可用的实际空间)。默认情况下,仅显示与您当前查看的产品/版本匹配的搜索结果。您可以通过单击历史记录栏右侧的 按钮并选择“全部”单选按钮来扩展显示的内容。这将显示历史记录栏中所有产品/版本的所有最近页面。
在历史记录配置菜单中,您还将看到最近访问页面的列表。结果按“当前产品/版本”和“全部”单选按钮进行过滤。单击 按钮将清除历史记录栏以及本地存储中保存的历史记录。
如果在历史记录配置菜单中选择“全部”,则将启用“在历史记录栏中显示产品详细信息”复选框选项。选中后,每个历史页面的产品/版本将与历史记录栏中的页面名称一起显示。将光标悬停在历史记录栏中的页面名称上也会将产品/版本显示为工具提示。
可以使用页面顶部的搜索字段搜索 API 文档和指南。
在 API 文档页面上,还有一个过滤器输入字段,它使用过滤器字符串过滤成员行。除了按字符串过滤外,您还可以按访问级别、继承和只读过滤类成员。这是通过使用页面顶部的复选框完成的。
API 类导航树底部的复选框过滤类列表以包括或排除私有类。
单击空搜索字段将显示您最近 10 次搜索,以便快速导航。
每个 API 文档页面(JavaScript 原始类型页面除外)都有一个与该类相关的元数据菜单视图。此元数据视图将具有以下一项或多项
Ext.button.Button
类具有 Ext.Button
的备用类名称)。备用类名称通常为了向后兼容性而维护。可运行的示例 (Fiddles) 默认在页面上展开。您可以使用代码块左上角的箭头单独折叠和展开示例代码块。您还可以使用页面右上角的切换按钮切换所有示例的折叠状态。切换所有状态将在页面加载之间记住。
类成员默认在页面上折叠。您可以使用成员行左侧的箭头图标或全局使用右上角的展开/折叠全部切换按钮来展开和折叠成员。
在较窄的屏幕或浏览器上查看文档将导致针对较小外形尺寸优化的视图。桌面视图和“移动”视图之间的主要区别在于
可以通过单击 API 文档页面顶部的类名来查看类源代码。可以通过单击成员行右侧的“查看源代码”链接来查看类成员的源代码。
Ext JS 30 天试用包可从公共 npm 安装。使用以下命令安装最新的 Ext JS 版本,然后跳到步骤 2。
$ npm install -g @sencha/ext-gen
Ext JS 和所有相关的商业软件包都托管在 Sencha 的私有 npm 注册表中。使用以下命令登录到注册表,该命令配置 npm 以从 Sencha 的注册表下载 @sencha 范围内的软件包。
用户名注意
支持门户激活期间使用的电子邮件和密码(购买许可证后)将用于登录 Sencha 的 NPM 仓库。用户名与使用的电子邮件相同,但是,@
字符替换为 '..' 两个句点。例如 [email protected]
转换为用户名:name..gmail.com
$ npm login --registry=https://npm.sencha.com/ --scope=@sencha
当您需要在服务器环境登录时,请使用此步骤。
~/.npmrc
文件中获取访问令牌。使用 npm 命令。将 $SENCHA_NPM_TOKEN_VERDACCIO
替换为您 ~/.npmrc
文件中的令牌。
npm config set @sencha:registry https://npm.sencha.com/
npm config set //npm.sencha.com/:_authToken=$SENCHA_NPM_TOKEN_VERDACCIO
创建并编写一个 ~/.npmrc 文件。将 %npm.sencha.com-authtoken%
替换为您 ~/.npmrc
文件中的令牌。
# Remove previous file
rm -f ~/.npmrc
# Write new ~/.npmrc
echo "Writing auth tokens to ~/.npmrc"
echo "@sencha:registry=http://npm.sencha.com" >> ~/.npmrc
echo "//npm.sencha.com/:_authToken=%npm.sencha.com-authtoken%" >> ~/.npmrc
# Debug
echo "Debug contents of ~/.npmrc:"
echo "~~~~~~~~~~~~~~~~~~~~~~"
cat ~/.npmrc
echo "~~~~~~~~~~~~~~~~~~~~~~"
# Check login with whoami
echo "Invoking NPM whoami"
echo "~~~~~~~~~~~~~~~~~~~~~~"
npm --registry http://npm.sencha.com/ whoami
echo "~~~~~~~~~~~~~~~~~~~~~~"
这是一个 Travis CI 示例配置。
env:
# npm.sencha.com
# gem install travis
# travis login --pro --github-token replace_with_github_personal_token
# cd to/repo
# travis encrypt SENCHA_NPM_TOKEN_VERDACCIO="replace_with_apikey"
# SENCHA_NPM_TOKEN_VERDACCIO - secure: "XXXX... generation removed"
# early-adopter
# travis encrypt SENCHA_NPM_TOKEN_EARLYADOPTER="replace_with_apikey"
- secure: "XXXX... generation removed"
os: osx
language: node_js
node_js:
- "lts/*"
cache:
npm: false
before_install:
# NPM Login - commercial
# - npm config set @sencha:registry https://npm.sencha.com/
# - npm config set //npm.sencha.com/:_authToken=$SENCHA_NPM_TOKEN_VERDACCIO
# NPM Login - early-adopter
- npm config set @sencha:registry https://sencha.myget.org/F/early-adopter/npm/
- npm config set //sencha.myget.org/F/early-adopter/npm/:_authToken=$SENCHA_NPM_TOKEN_EARLYADOPTER
install:
- cd internal-components
- npm install
script:
- npm run build
deploy:
skip_cleanup: true
provider: script
script: bash deploy.sh
on:
branch: master
# Run CLI in this repo
# Delete Cache
# travis cache
# travis cache --delete
注意:现有客户使用您的支持门户凭据。但将用户名中的 @
字符替换为 '..'
两个句点,因此转换后的用户名将如下所示:name..gmail.com
。
有时,特别是对于持续集成,您可能希望有一种场景,您不必担心访问凭据或身份验证来从我们的 NPM 仓库获取内容。
本节概述了您可以从我们的仓库下载所有 Sencha 节点软件包,并将它们本地保存,而无需持续身份验证的方法。
在本指南中,我们将使用目标本地目录“./vendor”来包含所有 Sencha 节点软件包。这可以命名为您认为有意义的任何名称。以下步骤假设您在应用程序的根目录中。
1. Login to Sencha’s NPM repository to authenticate yourself so you may access all Sencha packages.
> npm set @sencha:registry=https://npm.sencha.com
> npm login --registry=https://npm.sencha.com --scope=@sencha
2. While authenticated, install all Sencha packages required by your application except @sencha/ext-webpack-plugin.
3. After all packages are installed, copy the contents of ./node_modules/@sencha to ./vendor/@sencha. Ensure that any source control application you use has the ‘./vendor’ directory added to it so that these packages are available in any target system that will checkout your application.
4. Update your package.json to link all required packages to their new location in the ./vendor folder. For example:
“dependencies”: {
“@sencha/ext”: “file:vendor/@sencha/ext”
}
5. Next, update the package.json file for each individual Sencha package found in the ‘vendor’ directory (e.g. vendor/@sencha/ext/package.json). You will want to
a. Remove any/all “scripts” definitions in the file. For example:
“scripts”: {
“install”: “node authorize.js”
}
b. Update dependency references to reflect that other packages are now locally found in the vendor folder. For example:
“@dependencies”: {
“@sencha/ext-core”: “file:../ext-core”
}
c. Finally, remove any “_activatedby” property which may exist in the package.json (it should be located at the bottom). These properties are part of npm authentication and may cause issues if retained.
6. As you will no longer be using Sencha NPM server, unregister the packages locally from the server by editing your .npmrc file and commenting out the following line (if present) by placing a hash symbol at the start:
# @sencha:registry = “https://npm.sencha.com”
7. Delete your ./node modules directory along with the package-lock.json file.
8. Edit package.json and remove ‘@sencha/ext-webpack-plugin’ from the “devDependencies” block (if one exists).
9. Run npm install to re-populate the node_modules required for your application. This will also populate the ‘node_modules/@sencha’ directory with links to your vendor directory locations, rather than downloading the source from our repository.
10. Run npm install @sencha/ext-webpack-plugin --save-dev. NPM will install this package and its @sencha/cmd dependency from the public npm registry.
11. If you previously have a build server configured with any Sencha authentication, you may remove this authentication from any buildspec files. As you will be using your own local copy of our packages, Sencha npm repo authentication is no longer necessary.
12. Finally, commit these changes to any CVS and review CI/CD pipelines as necessary to ensure builds run correctly and without incident.
请参考以下 GIF 以查看该过程。
演示 1
演示 2
有关对 Sencha 仓库进行身份验证的故障排除,请参阅 Npm 故障排除