<template>
  <BaseSameLayer
    :hosSameLayerArgs="hosSameLayerArgs"
    embedType="native/midea-gesture-password"
    :defaultWidth="300"
    :defaultHeight="300"
  ></BaseSameLayer>
</template>

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

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

  methods: {
    // 自定义拓展其它逻辑
    handleFinish(res) {
      // 暂时不能用finish等内置方法，会被vue-precompiler加入一个undefined的stopPropagation()，导致回调异常
      // update 20240828 自定义的vue-precompiler 已经修复 by wuhl
      this.$emit("finish", res);
    },
  },
};
</script>
