Browse Source

Signed-off-by: Caner <5658514@qq.com>

Caner 2 years ago
parent
commit
35004d37d5
1 changed files with 21 additions and 21 deletions
  1. 21 21
      src/components/login.vue

+ 21 - 21
src/components/login.vue

@@ -1,3 +1,24 @@
+<script setup lang="ts">
+import { ref } from 'vue'
+
+const name = ref('')
+const roomID = ref('')
+const error = ref('')
+defineProps<{
+  err: string
+}>()
+const emit = defineEmits<{(evt: 'loginBack', value: { name: string, roomID: string }): void;
+}>()
+async function login() {
+  if (!roomID.value) {
+    error.value = '请输入房间号'
+  } else if (!name.value) {
+    error.value = '请输入昵称'
+  } else {
+    emit('loginBack', { name: name.value, roomID: roomID.value })
+  }
+}
+</script>
 <template>
   <div class="login">
     <div @keydown.enter="login">
@@ -25,27 +46,6 @@
     </div>
   </div>
 </template>
-<script setup lang="ts">
-import { ref } from 'vue'
-
-const name = ref('')
-const roomID = ref('')
-const error = ref('')
-defineProps<{
-  err: string
-}>()
-const emit = defineEmits<{(evt: 'loginBack', value: { name: string, roomID: string }): void;
-}>()
-async function login() {
-  if (!roomID.value) {
-    error.value = '请输入房间号'
-  } else if (!name.value) {
-    error.value = '请输入昵称'
-  } else {
-    emit('loginBack', { name: name.value, roomID: roomID.value })
-  }
-}
-</script>
 <style scoped lang="less">
 .login {
   width: 100%;