ionic 切换开关操作
作者:SunnyJourney
时间:2026-08-11
浏览:0
来看这个例子:切换不同开关的 checked 状态后,会显示对应的不同数值,其中 true 表示开启,false 表示关闭。 HTML 代码 开关切换 Settings {{ item.text }} Notifications Push Notifications Newsletter 考虑到 p
本文目录
来看这个例子:切换不同开关的 checked 状态后,会显示对应的不同数值,其中 true 表示开启,false 表示关闭。

HTML 代码
开关切换
Settings
{{ item.text }}
Notifications
Push Notifications
Newsletter
考虑到 pre 标签会产生冲突,示例里已经将原本的 pre 统一替换成了 div 标签,具体效果可以在"尝试一下"里直接查看。
Ja vaScript 代码
angular.module('ionicApp', ['ionic'])
.controller('MainCtrl', function($scope) {
$scope.settingsList = [
{ text: "Wireless", checked: true },
{ text: "GPS", checked: false },
{ text: "Bluetooth", checked: false }
];
$scope.pushNotificationChange = function() {
console.log('Push Notification Change', $scope.pushNotification.checked);
};
$scope.pushNotification = { checked: true };
$scope.emailNotification = 'Subscribed';
});
css 代码:
body {
cursor: url('http://www.runoob.com/try/demo_source/finger.png'), auto;
}
效果如下所示:
作者最新文章
漫蛙下载最新版本
2026-10-13 13:42
漫蛙app下载安装最新版
2026-10-13 13:42
漫蛙2漫画APP免费下载安装最新版本
2026-10-13 13:20
漫蛙漫画网页下载安装最新版本
2026-10-13 13:17
keyshot快捷键命令大全表格整理与使用教程
2026-10-12 14:13
上一篇:
ionic 手势事件
下一篇:
ionic 单选框操作
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多










































