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-09-16 17:43
SQL中ROUND函数对0.5的处理机制及强制四舍五入方法
2026-09-15 14:19
JS金额计算怎么避免四舍五入误差
2026-09-14 17:32
韩国8月携号转网数据:Galaxy Z8系列iPhone用户转化率约为Z7系列2倍
2026-09-08 17:02
AE基础教程:如何创建合成并制作关键帧动画
2026-09-04 09:27
上一篇:
ionic 手势事件
热门文章
更多
精品专题
更多
Mac软件
更多
WINDOWS
更多


































