uni-popup-share.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="uni-popup-share">
  3. <view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view>
  4. <view class="uni-share-content">
  5. <view class="uni-share-content-box">
  6. <view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)">
  7. <image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
  8. <text class="uni-share-text">{{item.text}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="uni-share-button-box">
  13. <button class="uni-share-button" @click="close">取消</button>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import popup from '../uni-popup/popup.js'
  19. export default {
  20. name: 'UniPopupShare',
  21. mixins:[popup],
  22. props: {
  23. title: {
  24. type: String,
  25. default: '分享到'
  26. },
  27. beforeClose: {
  28. type: Boolean,
  29. default: false
  30. }
  31. },
  32. data() {
  33. return {
  34. bottomData: [{
  35. text: '微信',
  36. icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/c2b17470-50be-11eb-b680-7980c8a877b8.png',
  37. name: 'wx'
  38. },
  39. {
  40. text: '支付宝',
  41. icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png',
  42. name: 'wx'
  43. },
  44. {
  45. text: 'QQ',
  46. icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/e7a79520-50be-11eb-b997-9918a5dda011.png',
  47. name: 'qq'
  48. },
  49. {
  50. text: '新浪',
  51. icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png',
  52. name: 'sina'
  53. },
  54. {
  55. text: '百度',
  56. icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
  57. name: 'copy'
  58. },
  59. {
  60. text: '其他',
  61. icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
  62. name: 'more'
  63. }
  64. ]
  65. }
  66. },
  67. created() {},
  68. methods: {
  69. /**
  70. * 选择内容
  71. */
  72. select(item, index) {
  73. this.$emit('select', {
  74. item,
  75. index
  76. })
  77. this.close()
  78. },
  79. /**
  80. * 关闭窗口
  81. */
  82. close() {
  83. if(this.beforeClose) return
  84. this.popup.close()
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .uni-popup-share {
  91. background-color: #fff;
  92. }
  93. .uni-share-title {
  94. /* #ifndef APP-NVUE */
  95. display: flex;
  96. /* #endif */
  97. flex-direction: row;
  98. align-items: center;
  99. justify-content: center;
  100. height: 40px;
  101. }
  102. .uni-share-title-text {
  103. font-size: 14px;
  104. color: #666;
  105. }
  106. .uni-share-content {
  107. /* #ifndef APP-NVUE */
  108. display: flex;
  109. /* #endif */
  110. flex-direction: row;
  111. justify-content: center;
  112. padding-top: 10px;
  113. }
  114. .uni-share-content-box {
  115. /* #ifndef APP-NVUE */
  116. display: flex;
  117. /* #endif */
  118. flex-direction: row;
  119. flex-wrap: wrap;
  120. width: 360px;
  121. }
  122. .uni-share-content-item {
  123. width: 90px;
  124. /* #ifndef APP-NVUE */
  125. display: flex;
  126. /* #endif */
  127. flex-direction: column;
  128. justify-content: center;
  129. padding: 10px 0;
  130. align-items: center;
  131. }
  132. .uni-share-content-item:active {
  133. background-color: #f5f5f5;
  134. }
  135. .uni-share-image {
  136. width: 30px;
  137. height: 30px;
  138. }
  139. .uni-share-text {
  140. margin-top: 10px;
  141. font-size: 14px;
  142. color: #3B4144;
  143. }
  144. .uni-share-button-box {
  145. /* #ifndef APP-NVUE */
  146. display: flex;
  147. /* #endif */
  148. flex-direction: row;
  149. padding: 10px 15px;
  150. }
  151. .uni-share-button {
  152. flex: 1;
  153. border-radius: 50px;
  154. color: #666;
  155. font-size: 16px;
  156. }
  157. .uni-share-button::after {
  158. border-radius: 50px;
  159. }
  160. </style>