ionic 添加简单的CSS动画

  • html

  • scss
.button1 {
    opacity: 1;
    transition: 2s linear !important;
  }
  • ts
//引用
import { Component,ViewChild,Renderer,ElementRef } from '@angular/core';

@ViewChild('myButton1',{read:ElementRef}) myButton1;

constructor( public renderer:Renderer) 
{
}

changeStyle1()
{
     this.renderer.setElementStyle(this.myButton1.nativeElement,"opacity","0");
}

this.renderer.setElementStyle(this.myButton1.nativeElement,"style参数"," value");

你可能感兴趣的:(ionic 添加简单的CSS动画)