Browse Source

使用 v-snackbar 替换 alert

reghao 3 năm trước cách đây
mục cha
commit
b82248dc7b
1 tập tin đã thay đổi với 22 bổ sung2 xóa
  1. 22 2
      src/components/login-form-mobile.vue

+ 22 - 2
src/components/login-form-mobile.vue

@@ -46,6 +46,23 @@
     <v-row justify="center">
       <v-btn color="primary" @click="submitLogin">登录/注册</v-btn>
     </v-row>
+    <v-snackbar
+      v-model="showMessage"
+      :top="true"
+      :timeout="1000"
+    >
+      {{ message }}
+      <template v-slot:action="{ attrs }">
+        <v-btn
+          color="pink"
+          text
+          v-bind="attrs"
+          @click="showMessage = false"
+        >
+          关闭
+        </v-btn>
+      </template>
+    </v-snackbar>
   </div>
 </template>
 
@@ -67,7 +84,9 @@ export default {
         password: null,
         captchaCode: null,
         r: null,
-        plat: 'web'
+        plat: 'web',
+        showMessage: false,
+        message: ''
       }
     }
   },
@@ -105,7 +124,8 @@ export default {
       getVerifyCode(verifyCodeReq)
         .then(res => {
           if (res.code === 0) {
-            alert(res.msg)
+            this.showMessage = true
+            this.message = '验证码已发送, 请注意查收'
           } else {
             console.error(res.msg)
           }