首页 > 解决方案 > 如何在 ionic 2/typescript 中使用自定义类

问题描述

我在我的中添加了一个自定义样式variables.scss来更改我的alert,但我不确定如何应用它。我已经看到了这个问题,但它对我没有帮助。我必须把这个放在我的typescript? 如果是,如何?

我的variabless.scss

.alert-wrapper {
  border-radius: 13px;
  overflow: hidden;
  max-width: 270px;
  background-color: #f8f8f8;
  -webkit-box-shadow: none;
  box-shadow: none;
}

html打电话报警

<button ion-button color="babydanger" (click)="showCheckbox()">SIGN UP</button>

我的.ts

showCheckbox() {
    let alert = this.alertCtrl.create();
    alert.setTitle('Which planets have you visited?');

    alert.addInput({
      type: 'checkbox',
      label: 'Alderaan',
      value: 'value1',
      checked: true
    });

    alert.addInput({
      type: 'checkbox',
      label: 'Bespin',
      value: 'value2'
    });

标签: ionic2

解决方案


推荐阅读