// components/local/homeSkeleton/homeSkeleton.js
Component({
  /**
   * 组件的属性列表
   */
  options: {
    multipleSlots: true
  },
  properties: {
    isLoading: {
      type: Boolean,
      value: true,
      observer(newVal) {
        if(newVal) {
          var animation= wx.createAnimation({}) //创建一个动画实例
          animation.opacity(1).step({
            duration:0
          });
          this.setData({
            showpic:animation.export(),
            hidden:true
          });
          return;
        }
        this.skeletonVis();
      }
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    hidden:true
  },

  /**
   * 组件的方法列表
   */
  methods: {
    skeletonVis() {
      var animation= wx.createAnimation({}) //创建一个动画实例
      animation.opacity(0).step({
        duration:500
      });
      // this.setData({
      //   showpic:animation.export(),
      // });
      
      setTimeout(() => {
        this.setData({
          showpic:animation.export(),
        },() => {
          setTimeout(() => {
            this.setData({
              hidden:false,
            })
          }, 500);
        });
      }, 500);
    }
  }
})