简介

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

 

 

 

 

 

 

 

 

 

 

DevExtreme 搭建Node.js开发环境的更多相关文章

  1. 快速搭建 Node.js 开发环境以及加速 npm

    如何快速搭建 node 开发环境 npm 超慢 github 无法打开的问题 于是我觉得应该写一篇文章解答所有这些起步问题,让新同学也能顺顺利利入门. 快速搭建 Node.js 开发环境 如果你想长期 ...

  2. 【转】使用nvm快速搭建 Node.js 开发环境

    原文链接:http://www.cnblogs.com/shuoer/p/7802891.html 快速搭建 Node.js 开发环境 如果你想长期做 node 开发, 或者想快速更新 node 版本 ...

  3. ES6 学习笔记 (2)-- Liunx环境安装Node.js 与 搭建 Node.js 开发环境

    笔记参考来源:廖雪峰老师的javascript全栈教程 一.安装Node.js 目前Node.js的最新版本是6.2.x.首先,从Node.js官网下载对应平台的安装程序. 1.下载 选择对应的Liu ...

  4. 手把手教你学node之搭建node.js开发环境

    搭建node.js开发环境 本文只针对在Linux或者Mac下面.至于使用 Windows 并坚持玩新技术的同学,我坚信他们一定有着过人的.甚至是不可告人的兼容性 bug 处理能力,所以这部分同学麻烦 ...

  5. 1.0搭建 Node.js 开发环境

    <搭建 Node.js 开发环境> 本课程假设大家都是在 Linux 或者 Mac 下面.至于使用 Windows 并坚持玩新技术的同学,我坚信他们一定有着过人的.甚至是不可告人的兼容性 ...

  6. MongoDB 搭建Node.js开发环境

    理解Mongoose Elegant MongoDB object modeling for Node.js   安装Mongoose   $ cnpm install --save mongoose ...

  7. Oracle 搭建Node.js开发环境

      先决条件 安装oralce客户端驱动. 安装node.js.   创建项目 安装oracledb模块 $npm install oracledb 如果失败了,你可能要爬墙.   参考package ...

  8. Linux虚拟机中 Node.js 开发环境搭建

    Node.js 开发环境搭建: 1.下载CentOS镜像文件和VMWare虚拟机程序; 2.安装VMWare——>添加虚拟机——>选择CentOS镜像文件即可默认安装带有桌面的Linux虚 ...

  9. [转载]Sublime Text 3 搭建 React.js 开发环境

    [转载]Sublime Text 3 搭建 React.js 开发环境 Sublime有很强的自定义功能,插件库很庞大,针对新语言插件更新很快,配合使用可以快速搭建适配语言的开发环境. 1. babe ...

随机推荐

  1. Linux之Vim编辑器的使用

    NAME vim - Vi IMproved, a programmers text editor #vi的改进,一个程序文本编辑器 1.移动光标的方法 Ctrl+f 屏幕向下移动一页 0(数字0) ...

  2. 三大文本处理工具grep、sed及awk

    一.   用grep在文件中搜索文本 grep能够接受正则表达式,生成各种格式的输出.除此之外,它还有大量有趣的选项. 1.  搜索包含特定模式的文本行: 2.  从stdin中读取: 3.  单个g ...

  3. flink学习笔记-快速生成Flink项目

    说明:本文为<Flink大数据项目实战>学习笔记,想通过视频系统学习Flink这个最火爆的大数据计算框架的同学,推荐学习课程: Flink大数据项目实战:http://t.cn/EJtKh ...

  4. C++基础学习10:继承

    继承是类与类之间的关系,是一个很简单很直观的概念,与现实世界中的继承(例如儿子继承父亲财产)类似. 继承可以理解为一个类从另一个类获取方法(函数)和属性(成员变量)的过程.如果类B继承于类A,那么B就 ...

  5. NSArray,NSMutable和NSSet,NSMutableSet和NSDictionary,NSMutableDictionary用法

    开始编写应用程序的代码时,可以利用大量的 Objective-C 框架.其中,为所有应用程序提供基本服务的 Foundation 框架尤为重要.Foundation 框架包括表示基本数据类型的值类(如 ...

  6. kuangbin专题七 HDU1754 I Hate It (单点修改维护最大值)

    很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少. 这让很多学生很反感. 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问.当然,老师有 ...

  7. ribbon负载均衡

    ribbon的负载均衡策略有很多 IRule 这是所有负载均衡策略的父接口,里边的核心方法就是choose方法,用来选择一个服务实例. AbstractLoadBalancerRule Abstrac ...

  8. Mybatis学习笔记(八) —— Mybatis整合spring

    一.整合思路 1.SqlSessionFactory对象应该放到spring容器中作为单例存在. 2.传统dao的开发方式中,应该从spring容器中获得sqlsession对象. 3.Mapper代 ...

  9. poj3728之离线LCA+dp思想/RMQ+LCA(非常好的题目)

    题意很简单 给一个树(n < 5w) 每个点有个权值,代表商品价格 若干个询问(5w) 对每个询问,问的是从u点走到v点(简单路径),商人在这个路径中的某点买入商品,然后在某点再卖出商品,   ...

  10. dataTable调用接口渲染数据,没有数据,报错

    当没有数据的时候,报错: 解决方法: 在后台那边处理一下,当没有数据的时候,令 data : ' ' 或者 data : [ ] 前端代码: var loading = layer.load(1, { ...