效果图

【Kevin Learn 小程序】-->cover-view_json

属性

参考:​​cover-view​

实例

  1. app.js
//app.js
App({
onLaunch: function () {
console.log('App Launch')
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
globalData: {
hasLogin: false
}
})
  1. app.json
{
"pages": [
"pages/cover/cover"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
  1. cover.js
Page({
onShareAppMessage() {
return {
title: 'cover-view',
path: 'page/component/pages/cover-view/cover-view'
}
},

data: {
latitude: 23.099994,
longitude: 113.324520,
}
})
  1. cover.json
{
"navigationBarTitleText": "cover-view 组件"
}
  1. cover.wxml
<view class="container">
<view class="page-body">
<view class="page-section page-section-gap">
<map
style="width: 100%; height: 300px;"
latitude="{{latitude}}"
longitude="{{longitude}}"
>
<cover-view class="cover-view">
<cover-view class="container">
<cover-view class="flex-wrp" style="flex-direction:row;">
<cover-view class="flex-item demo-text-1"></cover-view>
<cover-view class="flex-item demo-text-2"></cover-view>
<cover-view class="flex-item demo-text-3"></cover-view>
</cover-view>
</cover-view>
</cover-view>
</map>
</view>
</view>
</view>
  1. cover.wxss
.cover-view {
position: absolute;
top: calc(50% - 150rpx);
left: calc(50% - 300rpx);
/* opacity: .7; */
}

.flex-wrp{
display:flex;
}

.flex-item{
width: 200rpx;
height: 300rpx;
font-size: 26rpx;
}

.demo-text-1 {
background: rgba(26, 173, 25, 0.7);
}

.demo-text-2 {
background: rgba(39, 130, 215, 0.7);
}

.demo-text-3 {
background: rgba(255, 255, 255, 0.7);
}