uni-popup-share.vue 4.0 KB

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