Ver Fonte

🐞 fix(headTop): 添加链接

hxl há 8 meses atrás
pai
commit
b3ebdb69b7
2 ficheiros alterados com 11 adições e 3 exclusões
  1. 10 2
      src/components/headTop.vue
  2. 1 1
      src/utils/validate.js

+ 10 - 2
src/components/headTop.vue

@@ -16,11 +16,11 @@
         <!-- phone and email -->
       </div>
       <div class="phoneInfo">
-        <div class="phone">
+        <div class="phone" @click="call">
           <svg-icon icon-class="tel" class="icon" />
           <p>1300 67 61 61</p>
         </div>
-        <div class="email">
+        <div class="email" @click="sendEmail" >
           <svg-icon icon-class="email" class="icon" />
           <p>sales@trustypay.com.au</p>
         </div>
@@ -56,6 +56,12 @@ export default {
       // Perform search logic here
       console.log("Searching for:", this.searchQuery);
     },
+    call() {
+      window.location.href = "tel:1300676161";
+    },
+    sendEmail() {
+      window.location.href = "mailto:sales@trustypay.com.au";
+    },
   },
 };
 </script>
@@ -114,6 +120,7 @@ export default {
     .phone {
       display: flex;
       align-items: center;
+      cursor: pointer;
       p {
         margin: 0;
         padding: 8px 10px;
@@ -122,6 +129,7 @@ export default {
     .email {
       display: flex;
       align-items: center;
+      cursor: pointer;
       p {
         margin: 0;
         padding: 8px 10px;

+ 1 - 1
src/utils/validate.js

@@ -9,5 +9,5 @@ export function isEmail(str) {
     return /^([a-zA-Z0-9]+[-_\.]?)+@[a-zA-Z0-9]+\.[a-z]+$/.test(str)
 }
 export function isValidPhone(str) {
-    return /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/.test(str)
+    return /^[0-9]{10}$/.test(str)
 }