美文网首页
ionic 添加简单的CSS动画

ionic 添加简单的CSS动画

作者: OnceWhite | 来源:发表于2017-08-06 21:32 被阅读98次
    • html
    <button #myButton1 ion-button color="primary" class="button1" (click)="changeStyle1()">Click me1</button>
    
    • 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动画

          本文链接:https://www.haomeiwen.com/subject/wasnlxtx.html