<template>
  <BaseSameLayer
    :hosSameLayerArgs="hosSameLayerArgs"
    embedType="native/midea-drag-slider"
    :defaultWidth="300"
    :defaultHeight="40"
  ></BaseSameLayer>
</template>

<script>
import BaseSameLayer from "./baseSameLayer.vue";

export default {
  data() {
    return {
      width: 0,
      height: 0
    }
  },
  name: "MideaDragSlider",
  components: {
    BaseSameLayer,
  },
  props: {
    hosUniqueProps: {
      type: Object,
      default() {
        return {};
      },
    },
    data: {
    type: Object,
    default() {
      return {};
    },
  },
  },
  computed: {
    hosSameLayerArgs() {
      return {
        ...this.hosUniqueProps, // 鸿蒙原生组件独有属性
        width: this.width,
        height: this.height,
        data: this.data,
        handleOnChange: this.handleOnChange,
      };
    },
  },
  mounted() {
    this.width = this.$el.clientWidth;
    this.height = this.$el.clientHeight;
  },

  methods: {
    // 自定义拓展其它逻辑
    handleOnChange(res) {
      if (res.mode == 2) {  //停止滑动
          this.$emit("endProgress", res);
      } else {
          this.$emit("onProgress", res);
      }
    },
  },
};
</script>
