popup.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view>
  3. <!-- <view class="example">
  4. <view class="example-title">基本用法</view>
  5. <button type="button" @click="togglePopup('top')">顶部弹出 popup</button>
  6. <uniPopup :show="type === 'top'" position="top" mode="fixed" msg="顶部弹出popup" @hidePopup="togglePopup('')" />
  7. <button type="button" @click="togglePopup('middle')">居中弹出 popup</button>
  8. <uniPopup :show="type === 'middle'" position="middle" mode="fixed" msg="居中弹出popup" @hidePopup="togglePopup('')" />
  9. <button type="button" @click="togglePopup('bottom')">底部部弹出 popup</button>
  10. <uniPopup :show="type === 'bottom'" position="bottom" mode="fixed" msg="底部弹出popup" @hidePopup="togglePopup('')" />
  11. </view> -->
  12. <view class="example">
  13. <!-- <view class="example-title">slot用法</view> -->
  14. <!-- <button type="button" @click="togglePopup('middle-img')">居中弹出(插屏广告)</button> -->
  15. <uniPopup :show="type" position="middle" mode="insert" @hidePopup="togglePopup('')">
  16. <view @click="gomoney" class="uni-center center-box">
  17. <image class="image" :src="pictureUrl+'/uploads/home/adv/'+images" />
  18. </view>
  19. </uniPopup>
  20. <!-- <button type="button" @click="togglePopup('middle-list')">居中弹出(滚动列表)</button>
  21. <uniPopup :show="type === 'middle-list'" position="middle" mode="fixed" @hidePopup="togglePopup('')">
  22. <scroll-view :scroll-y="true" class="uni-center center-box">
  23. <view v-for="(item, index) in list" :key="index" class="uni-list-item">滚动列表数据 {{ item }}</view>
  24. </scroll-view>
  25. </uniPopup> -->
  26. <!-- <button type="button" data-position="bottom" @click="togglePopup('bottom-share')">底部弹出(分享界面)</button>
  27. <uniPopup :show="type === 'bottom-share'" position="bottom" @hidePopup="togglePopup('')">
  28. <view style="display: block;">
  29. <view class="bottom-title">分享到</view>
  30. <view class="bottom-content">
  31. <view v-for="(item, index) in bottomData" :key="index" class="bottom-content-box">
  32. <view :class="item.name" class="bottom-content-image">
  33. <text class="icon">{{ item.icon }}</text>
  34. </view>
  35. <view class="bottom-content-text">{{ item.text }}</view>
  36. </view>
  37. </view>
  38. <view class="bottom-btn" @click="togglePopup('')">取消分享</view>
  39. </view>
  40. </uniPopup> -->
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import uniPopup from './uni-popup.vue'
  46. export default {
  47. props: {
  48. ishow: {
  49. default: false,
  50. type: Boolean
  51. },
  52. images: {
  53. default: '',
  54. type: String
  55. }
  56. },
  57. components: {
  58. uniPopup
  59. },
  60. // watch: {
  61. // 'ishow':function(val) {
  62. // if(val) {
  63. // this.type = true;
  64. // }else {
  65. // this.type = false;
  66. // }
  67. // },
  68. // },
  69. data() {
  70. return {
  71. type: true,
  72. pictureUrl: this.pictureUrl,
  73. list: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
  74. bottomData: [{
  75. text: '微信',
  76. icon: '\ue6a4',
  77. name: 'wx'
  78. },
  79. {
  80. text: '朋友圈',
  81. icon: '\ue646',
  82. name: 'wx'
  83. },
  84. {
  85. text: 'QQ',
  86. icon: '\ue66b',
  87. name: 'qq'
  88. },
  89. {
  90. text: '新浪',
  91. icon: '\ue600',
  92. name: 'sina'
  93. },
  94. {
  95. text: '复制',
  96. icon: '\ue632',
  97. name: 'copy'
  98. },
  99. {
  100. text: '更多',
  101. icon: '\ue618',
  102. name: 'more'
  103. }
  104. ]
  105. };
  106. },
  107. onBackPress() {
  108. if (this.type !== '') {
  109. this.type = '';
  110. return true;
  111. }
  112. },
  113. methods: {
  114. togglePopup() {
  115. this.type = false;
  116. },
  117. gomoney() {
  118. uni.navigateTo({
  119. url:'/pages/myCenter/definite'
  120. })
  121. }
  122. }
  123. };
  124. </script>
  125. <style>
  126. page {
  127. display: flex;
  128. flex-direction: column;
  129. box-sizing: border-box;
  130. background-color: #fff
  131. }
  132. view {
  133. font-size: 28upx;
  134. line-height: inherit
  135. }
  136. .example {
  137. padding: 0 30upx 30upx
  138. }
  139. .example-title {
  140. font-size: 32upx;
  141. line-height: 32upx;
  142. color: #777;
  143. margin: 40upx 25upx;
  144. position: relative
  145. }
  146. .example .example-title {
  147. margin: 40upx 0
  148. }
  149. .example-body {
  150. padding: 0 40upx
  151. }
  152. .uni-padding-wrap {
  153. padding: 0 30upx;
  154. }
  155. button {
  156. margin: 20upx 0;
  157. }
  158. .uni-helllo-text {
  159. height: 100upx;
  160. line-height: 100upx;
  161. text-align: center;
  162. }
  163. .center-box {
  164. width: 700upx;
  165. height: 700upx;
  166. }
  167. .uni-list-item {
  168. text-align: left;
  169. line-height: 80upx;
  170. border-bottom: 1px #f5f5f5 solid;
  171. }
  172. .uni-list-item:last-child {
  173. border: none;
  174. }
  175. .center-box .image {
  176. width: 100%;
  177. height: 100%;
  178. }
  179. .bottom-title {
  180. line-height: 60upx;
  181. font-size: 24upx;
  182. padding: 15upx 0;
  183. }
  184. .bottom-content {
  185. display: flex;
  186. flex-wrap: wrap;
  187. padding: 0 35upx;
  188. }
  189. .bottom-content-box {
  190. display: flex;
  191. flex-direction: column;
  192. align-items: center;
  193. margin-bottom: 15upx;
  194. width: 25%;
  195. box-sizing: border-box;
  196. }
  197. .bottom-content-image {
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. width: 90upx;
  202. height: 90upx;
  203. overflow: hidden;
  204. background: #007aff;
  205. border-radius: 10upx;
  206. }
  207. .bottom-content-text {
  208. font-size: 26upx;
  209. color: #333;
  210. margin-top: 10upx;
  211. }
  212. .bottom-btn {
  213. height: 90upx;
  214. line-height: 90upx;
  215. border-top: 1px #f5f5f5 solid;
  216. }
  217. .bottom-content-image.wx {
  218. background: #00ce47;
  219. }
  220. .bottom-content-image.qq {
  221. background: #00b6f6;
  222. }
  223. .bottom-content-image.sina {
  224. background: #ff766a;
  225. }
  226. .bottom-content-image.copy {
  227. background: #07ccd0;
  228. }
  229. @font-face {
  230. font-family: 'iconfont';
  231. /* project id 1028200 */
  232. src: url('https://at.alicdn.com/t/font_1028200_47ewtwy4t04.ttf') format('truetype');
  233. }
  234. .icon {
  235. font-family: 'iconfont';
  236. font-size: 40upx;
  237. color: #fff;
  238. }
  239. </style>