惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
GRAHAM CLULEY
T
Tenable Blog
Know Your Adversary
Know Your Adversary
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Privacy International News Feed
S
Security Affairs
NISL@THU
NISL@THU
O
OpenAI News
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Schneier on Security
Schneier on Security
S
SegmentFault 最新的问题
S
Schneier on Security
G
Google Developers Blog
V
V2EX
C
Check Point Blog
U
Unit 42
Google DeepMind News
Google DeepMind News
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
Recent Announcements
Recent Announcements
M
MIT News - Artificial intelligence
S
Secure Thoughts
博客园 - 司徒正美
Recorded Future
Recorded Future
P
Proofpoint News Feed
Spread Privacy
Spread Privacy
K
Kaspersky official blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
AI
AI
博客园 - 聂微东
N
News and Events Feed by Topic
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Vulnerabilities – Threatpost
P
Palo Alto Networks Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
Recent Commits to openclaw:main
Recent Commits to openclaw:main
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
The Hacker News
The Hacker News
The Last Watchdog
The Last Watchdog
Project Zero
Project Zero
W
WeLiveSecurity
博客园 - Franky

博客园 - 八爻老骥

Gradle模块化项目中使用了非模块化库的编译方法 系统架构一一前端技术 系统架构一一ORM的应用 WPF下的RibbonApplicationMenu控件自定义 系统架构——多线程的应用 系统架构——前后端分离 为什么要学DirectX? D3D实战-在窗口中画一个三角形 - 八爻老骥 - 博客园 DirectX 入门1-初识DirectX Tool Kit DirectX 12 版 俄罗斯方块 WPF俄罗斯方块改进版 - 八爻老骥 - 博客园 【编程漫谈】用JAVA画多边形 【编程漫谈】单机与联机 往Angular应用程序中添加DevExtreme 【编程漫谈】程序的运行环境 【编程漫谈】程序的运行流程 【编程漫谈】程序的进入与退出 【编程漫谈】Hello world! WPF实战俄罗斯方块
创建DevExtreme应用程序
八爻老骥 · 2019-08-27 · via 博客园 - 八爻老骥

如果你从头开始一个项目,那就使用DevExtreme Angular 模板。生成的项目带导航菜单以及在响应布局中的几个对应的示例视图。

你可以使用 DevExtreme CLI 生成应用程序:

npx -p devextreme-cli devextreme new angular-app app-name
cd app-name
npm run start

npx 需要 npm v5.2 或更高。如果是之前的版本,要么升级 npm 要么安装全局 DevExtreme CLI 然后运行命令安装以下包:

npm i -g devextreme-cli
devextreme new angular-app app-name

这个程序中已经包含了DataGrid 组件。 下边的指导演示了如何加入其它的DevExtreme 组件,用 Button 组件来举个例子:

在要用到的地方,在NgModule 中导入DevExtreme组件模块。打开src/app/app-routing.module.ts文件,加入如下代码:
app-routing.module.ts

// ...
import { ..., DxButtonModule } from 'devextreme-angular';
 
@NgModule({
    imports: [ ..., DxButtonModule ],
    // ...
})
export class AppModule { }

配置DevExtreme 组件标记。添加以下代码到 src/app/pages/home/home.component.html 文件中:
home.component.html

<!-- ... -->
<dx-button
    text="Click me"
    (onClick)="helloWorld()">
</dx-button>
<!-- ... -->

申明Angular中的DevExtreme回调函数、事件句柄、绑定属性。这个例子中 onClick 事件句柄在 src/app/pages/home/home.component.ts 文件中:
home.component.ts

// ...
export class HomeComponent {
    helloWorld() {
        alert('Hello world!');
    }
}

你点了Home页面,你就可以看到按钮了。