<template>
  <div>
    <div>
      <el-dialog v-model="isOpen" title="请输入登录密码" width="30%">
        <el-input v-model="password" @keyup.enter="sure" type="password"></el-input>
        <template #footer>
          <span class="dialog-footer">
            <el-button @click="close">取消</el-button>
            <el-button type="primary" @click="sure">确认</el-button>
          </span>
        </template>
      </el-dialog>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted, toRef, watch } from "vue";
import { sm3 } from "sm-crypto";
const props = defineProps({
  showInputPassword: {
    type: Boolean,
    default: false,
  },
});
const emit = defineEmits(["closeIptPass", "surePass"]);
watch(
  () => props.showInputPassword,
  (newValue) => {
    // console.log(111);
    isOpen.value = newValue;
  }
);

const password = ref();
const isOpen = ref(props.showInputPassword);
const close = () => {
  password.value = "";
  emit("closeIptPass");
};
const sure = () => {
  emit("surePass",sm3(password.value));
  password.value = "";
};
</script>

<style lang="scss" scoped>
</style>