css - 如何在 ionic 框架中将背景颜色设置为 $actionsheet

标签 css cordova ionic-framework

这是代码,非常简单,从官方网站复制粘贴

$scope.show = function() {
        // Show the action sheet
        var hideSheet = $ionicActionSheet.show({
            destructiveText: 'Delete Photo',
            titleText: 'Modify your album',
            cancelText: 'Cancel <i class="icon ion-no-smoking"></i>',
            cancel: function() {
                // add cancel code..
            },
            buttonClicked: function(index) {
                return true;
            }
        });

        // For example's sake, hide the sheet after two seconds
        $timeout(function() {
        hideSheet();
        }, 2000);
    };

enter image description here

我想将取消按钮更改为红色背景,如何在 ionic 框架中实现它?

最佳答案

最简单的方法是使用浏览器查看标记(在终端中运行 ionic serve 之后),例如在 Chrome 中按 ctrl+shift+i,您可以在其中选择按钮并查看附加了哪些类。在您的情况下,您会看到类似这样的内容:

<div class="action-sheet-group action-sheet-cancel" ng-if="cancelText">
    <button class="button ng-binding" 
            ng-click="cancel()" 
            ng-bind-html="cancelText">Cancel</button>
</div>

它有父 div 的样式,子按钮是这样的:

.action-sheet-group {
  margin-bottom: 8px;
  border-radius: 4px;
  background-color: #fff;
  overflow: hidden;
}

.action-sheet .button {
  display: block;
  padding: 1px;
  width: 100%;
  border-radius: 0;
  border-color: #d1d3d6;
  background-color: transparent;
  color: #007aff;
  font-size: 21px;
}

如果您不使用 Sass,只需在 Sass 中或直接在您的样式表中更改这些值。

关于css - 如何在 ionic 框架中将背景颜色设置为 $actionsheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29325545/

相关文章:

ios - Cordova 插件仅在 iOS 第二次打开时出现线程警告。你如何获得插件来初始化onload?

java - cordova/Mobile First 应用程序中的“主要版本 51 比 5 更新”

android - ionic 标签菜单

html - 使用 CSS 裁剪和拉伸(stretch)图像以填充页面

html - 如何让flexbox统一?

javascript - 如何在 Phonegap 中将 UTF-8 或 Base64 数据写入本地存储(sdcard)上的文件(jpg/doc/pdf)

ios - iOS设备上的Phonegap调试需要拔出/插入才能工作

javascript - 为什么我的 Controller 会破坏我的代码?

java - 如何让我的幻灯片自动播放?

javascript - 浏览器如何加载网站内容的视觉呈现