uni-popup-share.vue 3.6 KB

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