footer.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="tui-footer-class tui-footer" :class="[fixed?'tui-fixed':'']" :style='{background:bgcolor}'>
  3. <view class="tui-footer-link" v-if="navigate.length>0">
  4. <block v-for="(item,index) in navigate" :key="index">
  5. <navigator class="tui-link" hover-class="tui-link-hover" :hover-stop-propagation="true" :style="{color:(item.color || '#596d96'),fontSize:px(item.size || 28)}"
  6. :open-type="item.type" :url="item.url" :target="item.target" :delta="item.delta" :app-id="item.appid"
  7. :path="item.path" :extra-data="item.extradata" :bindsuccess="item.bindsuccess" :bindfail="item.bindfail">{{item.text}}</navigator>
  8. </block>
  9. </view>
  10. <view class="tui-footer-copyright" :style="{color:color,fontSize:px(size)}">
  11. {{copyright}}
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: "tuiFooter",
  18. props: {
  19. //type target url delta appid path extradata bindsuccess bindfail text color size
  20. //链接设置 数据格式对应上面注释的属性值
  21. navigate: {
  22. type: Array,
  23. default:function(){
  24. return []
  25. }
  26. },
  27. //底部文本
  28. copyright: {
  29. type: String,
  30. default: "All Rights Reserved."
  31. },
  32. //copyright 字体颜色
  33. color: {
  34. type: String,
  35. default: "#A7A7A7"
  36. },
  37. //copyright 字体大小
  38. size: {
  39. type: Number,
  40. default: 24
  41. },
  42. //footer背景颜色
  43. bgcolor: {
  44. type: String,
  45. default: "none"
  46. },
  47. //是否固定在底部
  48. fixed: {
  49. type: Boolean,
  50. default: true
  51. }
  52. },
  53. methods: {
  54. px(num) {
  55. return uni.upx2px(num) + 'px'
  56. }
  57. }
  58. }
  59. </script>
  60. <style>
  61. .tui-footer {
  62. width: 100%;
  63. overflow: hidden;
  64. padding: 30upx 24upx;
  65. box-sizing: border-box;
  66. }
  67. .tui-fixed {
  68. position: fixed;
  69. z-index: 9999;
  70. bottom: 0;
  71. bottom: env(safe-area-inset-bottom);
  72. }
  73. .tui-footer-link {
  74. color: #596d96;
  75. display: flex;
  76. align-items: center;
  77. justify-content: center;
  78. font-size: 28upx;
  79. }
  80. .tui-link {
  81. position: relative;
  82. padding: 0 18upx;
  83. line-height: 1;
  84. }
  85. .tui-link::before {
  86. content: " ";
  87. position: absolute;
  88. right: 0;
  89. top: 0;
  90. width: 1px;
  91. bottom: 0;
  92. border-right: 1px solid #d3d3d3;
  93. -webkit-transform-origin: 100% 0;
  94. transform-origin: 100% 0;
  95. -webkit-transform: scaleX(0.5);
  96. transform: scaleX(0.5);
  97. }
  98. .tui-link:last-child::before {
  99. border-right: 0 !important
  100. }
  101. .tui-link-hover {
  102. opacity: 0.5
  103. }
  104. .tui-footer-copyright {
  105. font-size: 24upx;
  106. color: #A7A7A7;
  107. line-height: 1;
  108. text-align: center;
  109. padding-top: 16upx
  110. }
  111. </style>