Skip to content

Instantly share code, notes, and snippets.

@queses
Created May 27, 2017 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save queses/8b008a8b6f7b470cb0a8c5e1788d8c63 to your computer and use it in GitHub Desktop.
Save queses/8b008a8b6f7b470cb0a8c5e1788d8c63 to your computer and use it in GitHub Desktop.
An easy solution to solve phone number issue vith VueSSR
<template>
<a :href="`tel: ${this.fPhone}`">{{ fPhone }}</a>
</template>
<script>
export default {
props: {
phone: {
type: [String],
required: true
}
},
computed: {
fPhone () {
return this.phone.replace(/(\d{1})(\d{3})(\d{3})(\d{2})(\d{2})/, '+$1 ($2) $3-$4-$5')
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment