cover-view.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view>
  3. <page-head title="cover-view用于覆盖map、video等原生组件"></page-head>
  4. <view class="cover-content" v-if="showMap">
  5. <!-- TODO暂时条件编译解决支付宝小程序不能正常显示 cover-x -->
  6. <!-- #ifdef APP-PLUS -->
  7. <map>
  8. <cover-view class="cover-view">简单的cover-view</cover-view>
  9. <cover-image class="cover-image" src="/static/uni.png"></cover-image>
  10. </map>
  11. <!-- #endif -->
  12. <!-- #ifndef APP-PLUS -->
  13. <!-- #ifndef MP-QQ -->
  14. <map></map>
  15. <!-- #endif -->
  16. <!-- TODO QQ暂不支持地图组件 -->
  17. <!-- #ifdef MP-QQ -->
  18. <video class="video" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20181126-lite.m4v"></video>
  19. <!-- #endif -->
  20. <cover-view class="cover-view">简单的cover-view</cover-view>
  21. <!-- #ifndef MP-QQ -->
  22. <cover-image class="cover-image" src="/static/uni.png"></cover-image>
  23. <!-- #endif -->
  24. <!-- #endif -->
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. showMap: false
  33. };
  34. },
  35. onLoad() {
  36. // #ifdef APP-PLUS || MP-BAIDU
  37. setTimeout(()=>{
  38. this.showMap = true
  39. },350)
  40. // #endif
  41. // #ifndef APP-PLUS || MP-BAIDU
  42. this.showMap = true
  43. // #endif
  44. }
  45. }
  46. </script>
  47. <style>
  48. map {
  49. width: 750rpx;
  50. width: 100%;
  51. height: 600px;
  52. }
  53. .video {
  54. width: 100%;
  55. }
  56. .cover-content {
  57. position: relative;
  58. }
  59. .cover-view {
  60. position: absolute;
  61. left: 5px;
  62. top: 5px;
  63. width: 375rpx;
  64. text-align: center;
  65. background-color: #DDDDDD;
  66. }
  67. .cover-image {
  68. position: absolute;
  69. left: 0;
  70. top: 0;
  71. right: 0;
  72. bottom: 0;
  73. margin: auto;
  74. width: 96px;
  75. height: 96px;
  76. }
  77. </style>