uni-popup-share.vue 4.1 KB

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