uni-popup-share.vue 3.7 KB

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