1. 程式人生 > >refs屬性結合style

refs屬性結合style

watch: {
  scrollY1(newY){
   this.$refs.layer.style['transform']=`translate3d(0,${newY}px,0)`;
    this.$refs.layer.style['webkitTransform']=`translate3d(0,${newY}px,0)`;
  },

 scrollY2(newY){
        let tranlateY = Math.max(this.minTransalteY,newY);
        let Zindex = 0;
       this.$refs.layer.style['transform']=`translate3d(0,${tranlateY}px,0)`;
        this.$refs.layer.style['webkitTransform']=`translate3d(0,${newY}px,0)`;
        if(newY<this.minTransalteY){
          Zindex=10;
          this.$refs.bgImage.style.paddingTop=0;
          this.$refs.bgImage.style.height=`${RESERVED_HEIGHT}PX`
        }else{
          this.$refs.bgImage.style.paddingTop='70%';
          this.$refs.bgImage.style.height=0;
        }
        this.$refs.bgImage.style.zIndex=Zindex;
      },
},