- 教程
- 概述
- 环境设置(Environment Setup)
- 自动完成(Autocomplete)
- 角材料 - 底板(Bottom Sheet)
- Cards
- 小部件(Widgets)
- 布局(Layouts)
- 输入(Inputs)
- Icons
- Grids
- SideNav(SideNav)
- Fab 速拨号(Fab Speed Dial)
- 子头(Subheaders)
- Swipe
- 开关(Switches)
- 主题(Themes)
- 祝酒词(Toasts)
- 排版(Typography)
- 虚拟重复(Virtual Repeat)
- 白色框架(WhiteFrame)
- 有用的资源
- Buttons
- CheckBoxes
- Content
- DatePicker
- Dialogs
- Divider
- List
- Menu
- Menu Bar
- Progress Bars
- Radio Buttons
- Selects
- ListBox和ListCtrl(ListBox & ListCtrl)
- Sliders
- Tabs
- Toolbars
- Tooltips
- Chips
- Contact Chips
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Buttons
md-button是Angular Directive,是一个带有可选墨水波纹的按钮指令(默认情况下启用)。 如果提供了href或ng-href属性,则此指令充当锚元素。
属性 (Attributes)
下表列出了md-button不同属性的参数和说明。
Sr.No | 参数和描述 |
---|---|
1 | md-no-ink 如果设置为true,则禁用波纹墨水效果。 |
2 | ng-disabled 根据表达式启用/禁用。 |
3 | md-ripple-size 覆盖默认的纹波大小逻辑。 选项:完整,部分,自动。 |
4 | aria-label 为可访问性按钮添加替代文本,对图标按钮很有用。 如果未找到默认文本,则会记录警告。 |
例子 (Example)
以下示例显示了md-button指令的使用以及各种类型的按钮。
am_buttons.htm
<html lang = "en">
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
<style>
.buttondemo section {
background: #f7f7f7;
border-radius: 3px;
text-align: center;
margin: 1em;
position: relative !important;
padding-bottom: 10px;
}
.buttondemo md-content {
margin-right: 7px;
}
.buttondemo section .md-button {
margin-top: 16px;
margin-bottom: 16px;
}
.buttondemo .label {
position: absolute;
bottom: 5px;
left: 7px;
font-size: 14px;
opacity: 0.54;
}
</style>
<script language = "javascript">
angular
.module('firstApplication', ['ngMaterial'])
.controller('buttonController', buttonController);
function buttonController ($scope) {
$scope.title1 = 'Button';
$scope.title4 = 'Warn';
$scope.isDisabled = true;
$scope.googleUrl = 'http://google.com';
}
</script>
</head>
<body ng-app = "firstApplication">
<div class = "buttondemo" ng-controller = "buttonController">
<md-content>
<section layout = "row" layout-sm = "column" layout-align = "center center"
layout-wrap>
<md-button>{{title1}}</md-button>
<md-button md-no-ink class = "md-primary">Primary (md-no-ink)</md-button>
<md-button ng-disabled = "true" class = "md-primary">Disabled</md-button>
<md-button class = "md-warn">{{title4}}</md-button>
<div class = "label">Flat Buttons</div>
</section>
<section layout = "row" layout-sm = "column" layout-align = "center center"
layout-wrap>
<md-button class = "md-raised">Button</md-button>
<md-button class = "md-raised md-primary">Primary</md-button>
<md-button ng-disabled = "true" class = "md-raised md-primary">
Disabled</md-button>
<md-button class = "md-raised md-warn">Warn</md-button>
<div class = "label">Raised Buttons</div>
</section>
<section layout = "row" layout-sm = "column" layout-align = "center center"
layout-wrap>
<md-button class = "md-fab" aria-label = "add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-fab md-primary" aria-label = "add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-fab" ng-disabled = "true" aria-label = "add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-fab md-primary md-hue-2" aria-label = "add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-fab md-mini" aria-label = "add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-fab md-mini md-primary" aria-label = "add">
<md-icon class = "material-icons" style = "color: greenyellow;">
add</md-icon>
</md-button>
<div class = "label">FAB Buttons</div>
</section>
<section layout = "row" layout-sm = "column" layout-align = "center center"
layout-wrap>
<md-button ng-href = "{{googleUrl}}" target = "_blank">
Default Link</md-button>
<md-button class = "md-primary" ng-href = "{{googleUrl}}"
target = "_blank">Primary Link</md-button>
<md-button>Default Button</md-button>
<div class = "label">Link vs. Button</div>
</section>
<section layout = "row" layout-sm = "column" layout-align = "center center"
layout-wrap>
<md-button class = "md-primary md-hue-1">Primary Hue 1</md-button>
<md-button class = "md-warn md-raised md-hue-2">Warn Hue 2</md-button>
<md-button class = "md-accent">Accent</md-button>
<md-button class = "md-accent md-raised md-hue-1">Accent Hue 1</md-button>
<div class = "label">Themed Buttons</div>
</section>
<section layout = "row" layout-sm = "column" layout-align = "center center"
layout-wrap>
<md-button class = "md-icon-button md-primary" aria-label = "Add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-icon-button md-accent" aria-label = "Add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button class = "md-icon-button" aria-label = "Add">
<md-icon class = "material-icons">add</md-icon>
</md-button>
<md-button href = "http://google.com"
title = "Open Google.com in new window"
target = "_blank"
ng-disabled = "true"
class = "md-icon-button launch" >
<md-icon class = "material-icons">add</md-icon>
</md-button>
<div class = "label">Icon Buttons</div>
</section>
</md-content>
</div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论