// components/media-carousel/media-carousel.ts
Component({
  properties: {
    mediaList: {
      type: Array,
      value: [],
      observer: function (this: any, newVal: any[]) {
        this.setData({
          totalCount: newVal.length,
        });
      },
    },
    itemId: {
      type: String,
      value: "",
    },
    // 是否显示指示器
    showIndicator: {
      type: Boolean,
      value: true,
    },
    // 指示器颜色
    indicatorColor: {
      type: String,
      value: "rgba(255, 255, 255, 0.6)",
    },
    // 指示器激活颜色
    indicatorActiveColor: {
      type: String,
      value: "#fff",
    },
    // 是否自动播放
    autoplay: {
      type: Boolean,
      value: true,
    },
    // 自动播放间隔时间
    interval: {
      type: Number,
      value: 3000,
    },
    // 滑动动画时长
    duration: {
      type: Number,
      value: 500,
    },
    // 是否循环播放
    circular: {
      type: Boolean,
      value: true,
    },
  },
  data: {
    totalCount: 0,
  },
  methods: {
    // 全屏
    onFullscreenChange(this: any, e: WechatMiniprogram.VideoFullScreenChange) {
      const { fullScreen } = e.detail || {};
      this.triggerEvent("fullscreenchange", { fullScreen });
    },
  },
});
