| | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import BindStep2 from "./BindStep2"; |
| | | import BindStep3 from "./BindStep3"; |
| | | import store from "@/store"; |
| | | import { mapState } from 'pinia'; |
| | | <script setup name="UkeyBind"> |
| | | import BindStep2 from "./BindStep2"; |
| | | import BindStep3 from "./BindStep3"; |
| | | import {ref, watch} from "vue"; |
| | | import { useUKeyStore } from '@/store/ukey'; |
| | | import { storeToRefs } from 'pinia'; |
| | | const ukeyStore = useUKeyStore(); |
| | | const { id, isIn } = storeToRefs(ukeyStore); |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }); |
| | | |
| | | export default { |
| | | name: "UkeyBind", |
| | | components: { BindStep3, BindStep2 }, |
| | | props: { |
| | | visible: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | }, |
| | | computed: { |
| | | ...mapState(store.ukey, ['id', 'isIn']), |
| | | }, |
| | | watch: { |
| | | id: { |
| | | handler(id) { |
| | | if (id) { |
| | | this.active = 2; |
| | | } else { |
| | | this.active = 1; |
| | | } |
| | | }, |
| | | immediate: true |
| | | }, |
| | | }, |
| | | data() { |
| | | let active = this.isIn ? 2 : 1; |
| | | return { |
| | | active: active, |
| | | // id: "", |
| | | }; |
| | | }, |
| | | methods: { |
| | | next() { |
| | | this.active++; |
| | | }, |
| | | close() { |
| | | this.$emit("update:visible", false); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | // this.id = this.$store.state.ukey.id; |
| | | }, |
| | | }; |
| | | const active = ref(isIn.value ? 2 : 1); |
| | | const emit = defineEmits(["update:visible"]); |
| | | |
| | | watch( |
| | | () => id.value, |
| | | () => { |
| | | if (id.value) { |
| | | active.value = 2; |
| | | } else { |
| | | active.value = 1; |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | |
| | | function next() { |
| | | active.value++; |
| | | } |
| | | |
| | | function close() { |
| | | emit("update:visible", false); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |