- 教程
- 概述
- 环境设置(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
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Sliders
md-slider是一个Angular指令,用于显示范围组件。 它有两种模式 -
normal - 用户可以在宽范围的值之间滑动。 默认情况下存在此模式。
discrete - 用户可以在所选值之间滑动。 要启用离散模式,请使用mddiscrete和step属性。
属性 (Attributes)
下表列出了md-slider的不同属性的参数和说明。
Sr.No | 参数和描述 |
---|---|
1 | md-discrete 这决定了是否启用离散模式。 |
2 | step 允许用户选择的值之间的距离。 默认情况下,它为1。 |
3 | min 允许用户选择的最小值。 默认情况下,它为0。 |
4 | max 允许用户选择的最大值。 默认情况下,它是100。 |
例子 (Example)
以下示例显示了md-sidenav的使用以及sidenav组件的用法。
am_sliders.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">
<script language = "javascript">
angular
.module('firstApplication', ['ngMaterial'])
.controller('sliderController', sliderController);
function sliderController ($scope, $mdSidenav) {
$scope.color = {
red: Math.floor(Math.random() * 255),
green: Math.floor(Math.random() * 255),
blue: Math.floor(Math.random() * 255)
};
$scope.rating = 3;
$scope.disabled = 70;
}
</script>
</head>
<body ng-app = "firstApplication">
<div id = "sliderContainer" ng-controller = "sliderController as ctrl"
layout = "row" ng-cloak>
<md-content style = "margin: 16px; padding:16px">
<div layout>
<h4 style = "margin-top:10px">Default</h4>
<md-slider flex min = "0" max = "255" ng-model = "color.red"
aria-label = "red" id = "red-slider" class></md-slider>
<div flex = "20" layout layout-align = "center center">
<input flex type = "number" ng-model = "color.red" aria-label = "red"
aria-controls = "red-slider">
</div>
</div>
<div layout>
<h4 style = "margin-top:10px">Warning</h4>
<md-slider class = "md-warn" flex min = "0" max = "255"
ng-model = "color.green" aria-label = "green" id = "green-slider">
</md-slider>
<div flex = "20" layout layout-align = "center center">
<input flex type = "number" ng-model = "color.green"
aria-label = "green" aria-controls = "green-slider">
</div>
</div>
<div layout>
<h4 style = "margin-top:10px">Primary</h4>
<md-slider class = "md-primary" flex min = "0" max = "255"
ng-model = "color.blue" aria-label = "blue" id = "blue-slider">
</md-slider>
<div flex = "20" layout layout-align = "center center">
<input flex type = "number" ng-model = "color.blue" aria-label = "blue"
aria-controls = "blue-slider">
</div>
</div>
<div layout>
<h4 style = "margin-top:10px">Discrete</h4>
<md-slider flex md-discrete ng-model = "rating" step = "1" min = "1"
max = "5" aria-label = "rating"></md-slider>
<div flex = "20" layout layout-align = "center center">
<input flex type = "number" ng-model = "rating" aria-label = "rating"
aria-controls = "rating-slider">
</div>
</div>
<div layout>
<h4 style = "margin-top:10px">Disabled</h4>
<md-slider flex min = "0" max = "255" ng-model = "disabled"
ng-disabled = "true" aria-label = "Disabled"></md-slider>
</div>
<div layout>
<h4 style = "margin-top:10px">Disabled, Discrete</h4>
<md-slider flex md-discrete ng-model = "rating" step = "1" min = "1"
max = "5" aria-label = "disabled" ng-disabled = "true"></md-slider>
</div>
</md-content>
</div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论