widgetHref.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!--
  2. * @Author: lide1202@hotmail.com
  3. * @Date: 2021-3-13 11:04:24
  4. * @Last Modified by: lide1202@hotmail.com
  5. * @Last Modified time: 2021-3-13 11:04:24
  6. !-->
  7. <template>
  8. <a
  9. :href="styleColor.linkAdress"
  10. :style="styleColor"
  11. :target="styleColor.jumpMode"
  12. >{{ styleColor.text }}</a
  13. >
  14. </template>
  15. <script>
  16. export default {
  17. name: "WidgetHref",
  18. components: {},
  19. props: {
  20. value: Object,
  21. ispreview: Boolean,
  22. },
  23. data() {
  24. return {
  25. options: {},
  26. };
  27. },
  28. computed: {
  29. transStyle() {
  30. return this.objToOne(this.options);
  31. },
  32. styleColor() {
  33. return {
  34. position: this.ispreview ? "absolute" : "static",
  35. color: this.transStyle.color || "#fff",
  36. "font-weight": this.transStyle.fontWeight || "600",
  37. text: this.transStyle.text || "超链接",
  38. "font-size": this.transStyle.fontSize + "px" || "12px",
  39. "letter-spacing": this.transStyle.letterSpacing + "em",
  40. background: this.transStyle.background,
  41. "text-align": this.transStyle.textAlign,
  42. display:
  43. this.transStyle.hideLayer == undefined
  44. ? "block"
  45. : this.transStyle.hideLayer
  46. ? "none"
  47. : "block",
  48. width: this.transStyle.width + "px",
  49. height: this.transStyle.height + "px",
  50. left: this.transStyle.left + "px",
  51. top: this.transStyle.top + "px",
  52. right: this.transStyle.right + "px",
  53. linkAdress: this.transStyle.linkAdress,
  54. jumpMode: this.transStyle.jumpMode == "other" ? "_blank" : "_self",
  55. };
  56. },
  57. },
  58. watch: {
  59. value: {
  60. handler(val) {
  61. this.options = val;
  62. },
  63. deep: true,
  64. },
  65. },
  66. mounted() {
  67. this.options = this.value;
  68. },
  69. methods: {},
  70. };
  71. </script>
  72. <style scoped lang="scss">
  73. a {
  74. width: 100%;
  75. height: 100%;
  76. overflow: hidden;
  77. }
  78. </style>