uni-popup-share.vue 4.4 KB

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