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

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 抱影无眠

CentOS7安装Nginx实现API网关 CentOS7中添加新硬盘 CentOS7 安装oracle 客户端 CentOS7安装RabbitMQ CentOS7安装MongoDB3.6企业版 CentOS 搭建Redis4 环境 Nginx 在Windows下搭建静态Web服务 MongoDB 搭建Node.js开发环境 MongoDB Windows环境搭建 Oracle 搭建Node.js开发环境 搭建Node.js Redis开发环境 Redis Windows环境搭建 使用PM2守护Node.js应用 Windows下使用nvm管理多个Node.js 版本 vscode 插件todo-highlight Ionic 解决gradle下载慢的问题 Cmder 简明使用说明 Ionic2 开发环境搭建 Ionic2集成DevExtreme
DevExtreme 搭建Node.js开发环境
抱影无眠 · 2018-04-04 · via 博客园 - 抱影无眠

简介

DevExtreme is a component suite for creating highly responsive web applications for touch devices and traditional desktops.

创建Angular应用

$ ng new DevExtremeDemo --skip-install --skip-git

$ cnpm install

安装DevExtreme

$ cnpm install --save devextreme devextreme-angular

设置angular-cli.json 文件

"styles": [

"styles.scss",

"../node_modules/devextreme/dist/css/dx.common.css",

"../node_modules/devextreme/dist/css/dx.spa.css",

"../node_modules/devextreme/dist/css/dx.carmine.css"

],

参考源码

index.html

<!doctype html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>DevExtremeDemo</title>

<base href="/">

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="icon" type="image/x-icon" href="favicon.ico">

<link rel="stylesheet" type="text/css" href="assets/css/dx.common.css" />

<link rel="stylesheet" type="text/css" href="assets/css/dx.spa.css" />

<link rel="stylesheet" type="text/css" href="assets/css/dx.carmine.css" />

</head>

<body class="dx-viewport">

<app-root></app-root>

</body>

</html>

app.module.ts

import { BrowserModule } from '@angular/platform-browser';

import { NgModule } from '@angular/core';

import { DxButtonModule } from 'devextreme-angular';

import { AppComponent } from './app.component';

@NgModule({

declarations: [

AppComponent

],

imports: [

DxButtonModule,

BrowserModule

],

providers: [],

bootstrap: [AppComponent]

})

export class AppModule { }

app.component.html

<!--The content below is only a placeholder and can be replaced.-->

<div style="text-align:center">

<h1>

Welcome to DevExtreme!

</h1>

</div>

<dx-button text="Press me" (onClick)="hello()"></dx-button>

<div class="dx-fieldset">

<div class="dx-field">

<div class="dx-field-label">Normal</div>

<div class="dx-field-value">

<dx-button [text]="okButtonOptions.text" [type]="okButtonOptions.type" (onClick)="okButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Success</div>

<div class="dx-field-value">

<dx-button [text]="applyButtonOptions.text" [type]="applyButtonOptions.type" (onClick)="applyButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Default</div>

<div class="dx-field-value">

<dx-button [text]="doneButtonOptions.text" [type]="doneButtonOptions.type" (onClick)="doneButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Danger</div>

<div class="dx-field-value">

<dx-button [text]="deleteButtonOptions.text" [type]="deleteButtonOptions.type" (onClick)="deleteButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Back</div>

<div class="dx-field-value">

<dx-button [type]="backButtonOptions.type" (onClick)="backButtonOptions.onClick()"></dx-button>

</div>

</div>

</div>

app.component.html

<!--The content below is only a placeholder and can be replaced.-->

<div style="text-align:center">

<h1>

Welcome to DevExtreme!

</h1>

</div>

<dx-button text="Press me" (onClick)="hello()"></dx-button>

<div class="dx-fieldset">

<div class="dx-field">

<div class="dx-field-label">Normal</div>

<div class="dx-field-value">

<dx-button [text]="okButtonOptions.text" [type]="okButtonOptions.type" (onClick)="okButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Success</div>

<div class="dx-field-value">

<dx-button [text]="applyButtonOptions.text" [type]="applyButtonOptions.type" (onClick)="applyButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Default</div>

<div class="dx-field-value">

<dx-button [text]="doneButtonOptions.text" [type]="doneButtonOptions.type" (onClick)="doneButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Danger</div>

<div class="dx-field-value">

<dx-button [text]="deleteButtonOptions.text" [type]="deleteButtonOptions.type" (onClick)="deleteButtonOptions.onClick()"></dx-button>

</div>

</div>

<div class="dx-field">

<div class="dx-field-label">Back</div>

<div class="dx-field-value">

<dx-button [type]="backButtonOptions.type" (onClick)="backButtonOptions.onClick()"></dx-button>

</div>

</div>

</div>

app.component.ts

import { Component } from '@angular/core';

import notify from 'devextreme/ui/notify';

@Component({

selector: 'app-root',

templateUrl: './app.component.html',

styleUrls: ['./app.component.css']

})

export class AppComponent {

title = 'app';

okButtonOptions: any;

applyButtonOptions: any;

doneButtonOptions: any;

deleteButtonOptions: any;

backButtonOptions: any;

constructor(){

this.okButtonOptions = {

text: 'OK',

type: 'normal',

onClick: function (e) {

notify("The OK button was clicked");

}

};

this.applyButtonOptions = {

text: "Apply",

type: "success",

onClick: function (e) {

notify("The Apply button was clicked");

}

};

this.doneButtonOptions = {

text: "Done",

type: "default",

onClick: function (e) {

notify("The Done button was clicked");

}

};

this.deleteButtonOptions = {

text: "Delete",

type: "danger",

onClick: function (e) {

notify("The Delete button was clicked");

}

};

this.backButtonOptions = {

type: "back",

onClick: function (e) {

notify("The Back button was clicked");

}

};

}

hello() {

alert('Hello DevExtreme!');

}

}

运行

$ ng serve

浏览器中打开网址 http://localhost:4200/

参考资源

https://js.devexpress.com

https://github.com/devexpress/DevExtreme-angular