graceLink.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <!-- #ifdef APP-PLUS -->
  3. <text class="link" :data-url="url" @tap="openUrlForApp" :style="{color:color, lineHeight:lineHeight, fontSize:fontSize}">{{title}}</text>
  4. <!-- #endif -->
  5. <!-- #ifdef H5 -->
  6. <a :href="url" class="link" target="_blank" :style="{color:color, lineHeight:lineHeight, fontSize:fontSize}">{{title}}</a>
  7. <!-- #endif -->
  8. <!-- #ifdef MP -->
  9. <text class="link" :style="{color:color, lineHeight:lineHeight, fontSize:fontSize}">{{url}}</text>
  10. <!-- #endif -->
  11. </template>
  12. <script>
  13. export default {
  14. props: {
  15. url:{
  16. type : String,
  17. default : ""
  18. },
  19. title : {
  20. type : String,
  21. default : ""
  22. },
  23. color:{
  24. type : String,
  25. default : "#3688FF"
  26. },
  27. fontSize : {
  28. type : String,
  29. default : "28rpx"
  30. },
  31. lineHeight : {
  32. type : String,
  33. default : "50rpx"
  34. }
  35. },
  36. methods:{
  37. openUrlForApp : function(e){
  38. var link = e.currentTarget.dataset.url;
  39. plus.runtime.openURL(link);
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped>
  45. .link{text-decoration:none;}
  46. </style>